Tag Archives: cryptography

(Python) ARC4

This is a pure Python implementation of raw ARC4, sans any improvements. For instance, it could take a nonce, use multiple state spaces (parallelizable), automatically discard the first 4K of the state space(s), use a more complex transformation than a simple swap, limit the # of bytes encrypted per nonce, etc.. The size of the [...]

Posted in Python | Also tagged , , , , , | Leave a comment

(Python) HMAC

HMAC, pass a hash from Crypto.Hash in PyCrypto. Key should be a bytes object. Returns a bytearray.

Posted in Python | Also tagged , , , , | Leave a comment

Primality testing with Fermat’s little theorem and Miller-Rabin in C#

Prime numbers have many applications. For example, in cryptography. The RSA algorithm for public-key cryptography uses large prime numbers for generating keys. Quote: The RSA algorithm works as follows: take two large primes, p and q, and compute their product n = pq; n is called the modulus. Choose a number, e, less than n [...]

Posted in C# | Also tagged , , , , , , , , , , , , , , , , | 2 Comments

Blowfish-based hashing for passwords in PHP

Storing passwords in a secure manner is very essential. Users can fall victim of cybercrime if a system containing the passwords of the users has been breached. DataLossDB illustrates the amount of data lost due to breaches. A cryptographic hash function can be used for creating a representation of a plaintext password, also known as [...]

Posted in PHP | Also tagged , , , , , , , , , , , | 2 Comments