On 2013-06-27, at 11:49, "Dearlove, Christopher (UK)" <chris.dearlove@xxxxxxxxxxxxxx> wrote: > RFC 6234 contains, embedded in it, code to implement various functions, including SHA-2. > > Extracting that code from the RFC is not a clean process. In addition the code must have existed unembedded before being embedded. > > Is that code available from the IETF or elsewhere? > > (I have tried some approaches to finding such code before posting here, but none successful.) Turns out that extracting the code from the RFC is only twenty minutes' work. Probably faster just to do it than to talk about it. If you'd like a copy of the files I extracted from the RFC text, I can easily send you a tarball. In general I think that maintaining code repositories is non-trivial, and also has been known (especially with respect to crypto/hash algorithms) to run into export licensing issues. Maintaining an archives of RFCs is already a core competency for the IETF, and (at least in some cases) exporting text is less problematic than exporting code. Joe [krill:~]% mkdir 6234 [krill:~]% cd 6234 [krill:~/6234]% curl -O 'http://tools.ietf.org/rfc/rfc6234.txt' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 231k 100 231k 0 0 190k 0 0:00:01 0:00:01 --:--:-- 190k [krill:~/6234]% vi rfc6234.txt [krill:~/6234]% ls hkdf.c sha.h stdint-example.h hmac.c sha1.c test-driver.c rfc6234.txt sha224-256.c usha.c sha-private.h sha384-512.c [krill:~/6234]% vi *.h *.c 10 files to edit [krill:~/6234]% date Thu 27 Jun 2013 13:14:53 EDT [krill:~/6234]% [krill:~/6234]% cc -c hmac.c [krill:~/6234]% cc -c sha1.c [krill:~/6234]% cc -c sha224-256.c [krill:~/6234]% cc -c sha384-512.c [krill:~/6234]% cc -c usha.c [krill:~/6234]% cc -c test-driver.c [krill:~/6234]% ls hkdf.c sha.h sha384-512.o hkdf.o sha1.c stdint-example.h hmac.c sha1.o test-driver.c hmac.o sha224-256.c test-driver.o rfc6234.txt sha224-256.o usha.c sha-private.h sha384-512.c usha.o [krill:~/6234]% cc -o test-driver *.o [krill:~/6234]% ./test-driver| egrep '(PASS|FAIL)' SHA1 sha standard test 1: PASSED SHA1 sha standard test 2: PASSED SHA1 sha standard test 3: PASSED SHA1 sha standard test 4: PASSED SHA1 sha standard test 5: PASSED SHA1 sha standard test 6: PASSED SHA1 sha standard test 7: PASSED SHA1 sha standard test 8: PASSED SHA1 sha standard test 9: PASSED SHA1 sha standard test 10: PASSED SHA1 random test 0: PASSED SHA1 random test 1: PASSED SHA1 random test 2: PASSED SHA1 random test 3: PASSED SHA224 sha standard test 1: PASSED SHA224 sha standard test 2: PASSED SHA224 sha standard test 3: PASSED SHA224 sha standard test 4: PASSED SHA224 sha standard test 5: PASSED SHA224 sha standard test 6: PASSED SHA224 sha standard test 7: PASSED SHA224 sha standard test 8: PASSED SHA224 sha standard test 9: PASSED SHA224 sha standard test 10: PASSED SHA224 random test 0: PASSED SHA224 random test 1: PASSED SHA224 random test 2: PASSED SHA224 random test 3: PASSED SHA256 sha standard test 1: PASSED SHA256 sha standard test 2: PASSED SHA256 sha standard test 3: PASSED SHA256 sha standard test 4: PASSED SHA256 sha standard test 5: PASSED SHA256 sha standard test 6: PASSED SHA256 sha standard test 7: PASSED SHA256 sha standard test 8: PASSED SHA256 sha standard test 9: PASSED SHA256 sha standard test 10: PASSED SHA256 random test 0: PASSED SHA256 random test 1: PASSED SHA256 random test 2: PASSED SHA256 random test 3: PASSED SHA384 sha standard test 1: PASSED SHA384 sha standard test 2: PASSED SHA384 sha standard test 3: PASSED SHA384 sha standard test 4: PASSED SHA384 sha standard test 5: PASSED SHA384 sha standard test 6: PASSED SHA384 sha standard test 7: PASSED SHA384 sha standard test 8: PASSED SHA384 sha standard test 9: PASSED SHA384 sha standard test 10: PASSED SHA384 random test 0: PASSED SHA384 random test 1: PASSED SHA384 random test 2: PASSED SHA384 random test 3: PASSED SHA512 sha standard test 1: PASSED SHA512 sha standard test 2: PASSED SHA512 sha standard test 3: PASSED SHA512 sha standard test 4: PASSED SHA512 sha standard test 5: PASSED SHA512 sha standard test 6: PASSED SHA512 sha standard test 7: PASSED SHA512 sha standard test 8: PASSED SHA512 sha standard test 9: PASSED SHA512 sha standard test 10: PASSED SHA512 random test 0: PASSED SHA512 random test 1: PASSED SHA512 random test 2: PASSED SHA512 random test 3: PASSED [krill:~/6234]%