Over the long weekend, I finished porting the ISAAC-64 algorithm from C to Common Lisp, and it is now included in the CL-ISAAC package on GitHub: https://github.com/thephoeron/cl-isaac. The new version (1.0.2) including ISAAC-64 will be available through Quicklisp in next month’s update; but if you would like to try it right away, you can clone the repo into
~/quicklisp/local-projects/ and give the Quick Recipe a try:
;; generate a 512-bit hex string token using ISAAC-64 context (defvar my-isaac64-ctx (isaac:init-kernel-seed :is64 t)) (format nil "~64,'0x" (isaac:rand-bits-64 my-isaac64-ctx 512)) => "6F00D098A342450CD7A2C27D941625ED70E7F7F4DD0BD46D8D1597361F0AA49180728D9BA062A14E6795F579D5B04B01F92310F18921A7397C57CF09012E104F"
Note that the interface for CL-ISAAC is mostly unchanged. If you wish to upgrade your codebase to use the ISAAC-64 algorithm, simply set the keyword value
:is64 t on
init-null-seed, as necessary. You can then use the new functions
rand-bits-64 to generate your random values.
The complete list of new exported symbols:
- struct isaac64-ctx
- function generate-next-isaac64-block ctx => nil
- function rand64 ctx => random 64-bit value
- function rand-bits-64 ctx n => random N-bit value
- macro mix64 a b c d e f g h
- function scramble64 ctx => scrambled ctx
- function jenkins-output-64 filename => nil
About: CL-ISAAC is a Common Lisp library for fast cryptographic random number generation. From the documentation on the original C implementation: “ISAAC-64 generates a different sequence than ISAAC, but it uses the same principles. It uses 64-bit arithmetic. It generates a 64-bit result every 19 instructions. All cycles are at least 272 values, and the average cycle length is 216583.”
Currently ISAAC-64 is only available on x86-64 systems. If you would like it to be made available on your 64-bit platform, or discover any bugs, please create an issue on the master GitHub repo: https://github.com/thephoeron/cl-isaac/issues.