Skip to content

Instantly share code, notes, and snippets.

View AdamWhiteHat's full-sized avatar
🏠
Working from home

Adam White AdamWhiteHat

🏠
Working from home
View GitHub Profile
@AdamWhiteHat
AdamWhiteHat / BigIntegerExtensionMethods.cs
Last active April 27, 2022 13:03
BigInteger ExtensionMethods
public static class BigIntegerExtensionMethods
{
public static BigInteger Sum(this IEnumerable<BigInteger> source)
{
return source.Aggregate((accumulator, current) => accumulator + current);
}
public static BigInteger Product(this IEnumerable<BigInteger> source)
{
return source.Aggregate((accumulator, current) => accumulator * current);
@AdamWhiteHat
AdamWhiteHat / HashCodeHelper.cs
Last active December 22, 2020 10:28
Combine two hashcodes
public static class HashCodeHelper
{
public static int Combine(int h1, int h2)
{
uint num = (uint)((h1 << 5) | (int)((uint)h1 >> 27));
return ((int)num + h1) ^ h2;
}
}
@tuxxy
tuxxy / homomorphic_rsa_demo.py
Last active October 31, 2019 03:16
This is a demo of the multiplicative homomorphic qualities of unpadded RSA encryption.
#!/usr/bin/env python3
from Cryptodome.PublicKey import RSA
# A proof of concept demo showing the multiplicative limited
# homomorphic qualities of unpadded RSA
# (Unpadded RSA is not secure by modern standards)
def gen_key(size):
key = RSA.generate(size)
@AdamWhiteHat
AdamWhiteHat / prime-sieve.svg
Created December 22, 2016 21:21
Javascript in SVG example (prime circles)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.