Memfrob
November 10, 2020
We give a function that performs encryption, and leave it to the reader to wrap that in a function that handles files:
(define (memfrob str) (define (frob c) (integer->char (bitwise-xor (char->integer c) 42))) (list->string (map frob (string->list str)))) > (memfrob (memfrob "Programming Praxis")) "Programming Praxis"
You can run the program at http://ideone.com/RnJDWB.
A quick solution using standard Scheme:
In Python:
Input argument must be a bytes-like object.
Here are a few solutions in C. The first is a plain vanilla implementation, followed by an implementation that uses
memfrob
from the GNU C library, and then an implementation that uses AVX2 intrinsics (the other solutions—compiled with optimizations—are still faster in my tests on a large file).Example usage: