WeSearch

ChaCha20 in Brainfuck

·2 min read · 0 reactions · 0 comments · 1 view
#cryptography#programming#encryption#brainfuck#chacha20#ChaCha20#Brainfuck
ChaCha20 in Brainfuck
⚡ TL;DR · AI summary

ChaCha20 is a secure stream cipher that generates a pseudo-random keystream through 20 rounds of operations on a 4x4 matrix of 32-bit integers, which is then XORed with plaintext to produce ciphertext. Brainfuck, an esoteric programming language known for its minimalism, has been used to implement a ChaCha20 encryptor consisting of over 140,000 instructions. The implementation is presented as a web-based tool requiring JavaScript, allowing users to observe the encryption process in action.

Key facts
Original article
mid's site
Read full at mid's site →
Opening excerpt (first ~120 words) tap to expand

ChaCha20 is an electronic cipher thought to be secure against advanced adversaries. It computes a pseudo-random bitstream, the keystream, by operating on a 4x4 matrix of 32-bit integers. The core consists of the quarter-round function, which takes in four variables and kneads them like so: a = a plus b, d = d xor a, d = d rol 16 c = c plus d, b = b xor c, b = b rol 12 a = a plus b, d = d xor a, d = d rol 8 c = c plus d, b = b xor c, b = b rol 7 This quarter-round function is applied to each column of the matrix, giving you one round. The second round applies the same quarter-round function to each diagonal of the matrix. Subsequent rounds alternate between columns and diagonals. Initially, this matrix holds the key, block counter, nonce (one-time number) and a cipher-wide constant.

Excerpt limited to ~120 words for fair-use compliance. The full article is at mid's site.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from mid's site