Creating SHA256 constant values on the fly without memory usuage Is it possible to create the constants used in SHA256 on the fly? Meaning I dont have to reserve 64 32-bit words of space? It would result in a slower implementation, but at the profit of using less memory. I know it is possible to do it with AES Sboxes, but how about the SHA256 constants?
If you look at the specification to understand how those constants were chosen, you'll realize you waste more memory generating them &quot;on the fly&quot;.
SHA-256 compression function key schedule constants are calculated as the fraction part of cubic-root of the first 64 prime numbers. You said you coud delete them after use (in the comment), but wouldn't that overlap with DRAM allocated for message buffer or something else? If you need a memory-compact implementation, this would be an anti-optimization.
If you desire a hash function without large memory footprint, you could consider SHA-3/Keccak, it too has some constants, but generating them &quot;on the fly&quot; requires only few additional registers to hold values from a LSFR.