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
# ElGamal encryption | |
import random | |
from sympy import isprime, mod_inverse | |
# Generate a large prime number for the modulus (p) | |
def generate_large_prime(bits=256): | |
while True: | |
p = random.getrandbits(bits) | |
if isprime(p): |
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
import hashlib | |
import secrets | |
# Elliptic Curve Parameters (placeholders for educational purposes) | |
p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F # Field prime | |
a = 0 | |
b = 7 | |
n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Order of G | |
# Base point G (using Bitcoin's secp256k1 parameters for illustration) |
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
''' | |
Schnorr Digital Signature Scheme based on paper: | |
Efficient Signature Generation by Smart Cards, published in March 1991 by Claus-Peter Schnorr | |
''' | |
from random import randint | |
import sympy | |
import hashlib |
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
/** | |
Running test...key : 803D8AB2E5B6E6FCA715737C3A82F7CE3C783124F6D51CD0 | |
Session keys match... | |
OK. | |
Generating random keys...OK | |
Private Key for Alice : 31FA1084 | |
Private Key for Bob : 2D748885 | |
Generating public keys... | |
Public Key for Alice : (10DEE015, 7A458BE8) |
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
/** | |
ECC-32 implementation | |
Private Key for Alice : 775bd026 | |
Private Key for Bob : 5133580e | |
Public Key for Alice : (32f20f84, 63852a02) | |
Public Key for Bob : (6d4444c2, 1563edf9) | |
Session Key for Alice : (2f3a9fa3, 6a9fa1ce) |
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
# | |
# ECDH using P-192 prime192v1 | |
# | |
# Runs very slow because of binary methods used. | |
# | |
import random | |
# Elliptic curve parameters P-192 prime192v1 | |
p = 0xfffffffffffffffffffffffffffffffeffffffffffffffff |
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
// | |
// Simple regexp example using IRegExp interface. | |
// | |
/** | |
# Found 4 matches. | |
> [email protected] | |
> [email protected] |
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
// | |
// Simple obfuscation using byte substitution | |
// | |
#include <cstdio> | |
#include <cstdint> | |
#include <cstdlib> | |
#include <cstring> | |
#include <cmath> |
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
// | |
// @modexpblog | |
// | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
#include <cstdint> | |
#include <ctime> | |
#include <cmath> | |
#include <fcntl.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
// | |
// How to locate the NT Delegate Callback Table in x86 builds of ntdll.dll | |
// | |
// @modexpblog | |
// | |
#define PHNT_VERSION PHNT_THRESHOLD | |
#include <phnt_windows.h> | |
#include <phnt.h> |