This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
// Helper to get/set elements in a 1D matrix (row-major) | |
#define MAT(m, row, col, numCols) ((m)[(row)*(numCols)+(col)]) | |
// Swap two rows in a 1D array | |
void swapRows(int *matrix, int row1, int row2, int numCols) { | |
for (int col = 0; col < numCols; col++) { | |
int temp = MAT(matrix, row1, col, numCols); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Full guide : https://leetarxiv.substack.com/p/solving-pell-equations-with-index | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
#include <math.h> | |
#include <gmp.h> | |
#define STB_DS_IMPLEMENTATION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Full guide: https://leetarxiv.substack.com/p/row-reduction-over-finite-fields | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
// Function to compute modular inverse using Fermat's Little Theorem | |
long modinv(long a, long p) | |
{ | |
long result = 1; | |
long power = p - 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Full guide: https://leetarxiv.substack.com/p/hacking-dormant-bitcoin-wallets-c | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
#include <gmp.h> | |
#include <secp256k1.h> | |
#include <openssl/sha.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Full guide here:https://leetarxiv.substack.com/p/hacking-dormant-bitcoin-wallets-c | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <gmp.h> | |
#include <secp256k1.h> | |
#include <openssl/sha.h> | |
#include <openssl/ripemd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Complete guide : https://leetarxiv.substack.com/p/hacking-dormant-bitcoin-wallets-c | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <secp256k1.h> | |
#include <openssl/sha.h> | |
#include <openssl/ripemd.h> | |
//Run: clear && gcc PrivateKey.c -lsecp256k1 -lcrypto -o m.o && ./m.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <assert.h> | |
#define INDEX(x, y, cols) ((x) * (cols) + (y)) | |
//We use unsigned integers | |
//Using signed integers is misaligned with our goal (Positive only integers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Second Checkpoint in: https://leetarxiv.substack.com/p/positive-only-binary-pmat32 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <assert.h> | |
#define INDEX(x, y, cols) ((x) * (cols) + (y)) | |
typedef uint32_t PMat32; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Full guide : https://leetarxiv.substack.com/p/positive-only-binary-pmat32 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <assert.h> | |
#define INDEX(x, y, cols) ((x) * (cols) + (y)) | |
//Run : clear && gcc PMat.c -lm -o m.o && ./m.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int FirstPrimeFactor(int n) | |
{ | |
if(n == 0 || n == 1) | |
{ | |
return n; // 0 and 1 have no prime factors | |
} | |
if(n < 0) | |
{ | |
n = -n; // Work with absolute value | |
} |
NewerOlder