8 karma · joined Sep 23, 2015 (11y ago) · 2 submissions
comment 10y ago · link · parent
In oversimplified pseudo-code:
def encrypt(data, key):
counter = 0
for block in data:
yield block ^ mix(counter, key)
counter += 1
def generate(key):
counter = 0
while True:
yield mix(counter, key)
counter += 1
def hash(data, key):
state = 0
for block in data:
state = block ^ mix(state, key)
return state
And similarly, if you have any one of those functions you can implement the rest. Xor with an unpredictable stream of numbers is a good encryption method, encrypting a string of zeroes should give you unpredictable random numbers and the hash can be used as the mix function when implementing the others, etc.comment 11y ago · link · parent
# program time change
./ray-ml: 21.46 # Original ocaml
./ray-cpp: 17.63 # Original c++
./ray-cpp-no-dtor: 13.86 # Removed all cleanup, ocaml doesn't do it
./ray-cpp-2: 8.90 # Changed list to vector
./ray-cpp-3: 7.89 # Removed virtual functions
./ray-cpp-4: 5.64 # Preallocated large array for all Groups