rbnacl-libsodium 0.4.5a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/.gitmodules +3 -0
- data/CHANGES.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +23 -0
- data/Rakefile +1 -0
- data/ext/rbnacl/extconf.rb +30 -0
- data/lib/rbnacl/libsodium.rb +11 -0
- data/lib/rbnacl/libsodium/version.rb +5 -0
- data/rbnacl-libsodium.gemspec +25 -0
- data/vendor/libsodium/AUTHORS +101 -0
- data/vendor/libsodium/ChangeLog +68 -0
- data/vendor/libsodium/LICENSE +16 -0
- data/vendor/libsodium/Makefile.am +20 -0
- data/vendor/libsodium/README +1 -0
- data/vendor/libsodium/README.markdown +246 -0
- data/vendor/libsodium/THANKS +17 -0
- data/vendor/libsodium/autogen.sh +16 -0
- data/vendor/libsodium/configure.ac +405 -0
- data/vendor/libsodium/dist-build/android.sh +48 -0
- data/vendor/libsodium/dist-build/iphone.sh +16 -0
- data/vendor/libsodium/dist-build/msys.sh +9 -0
- data/vendor/libsodium/libsodium.pc.in +11 -0
- data/vendor/libsodium/libsodium.sln +38 -0
- data/vendor/libsodium/libsodium.vcxproj +508 -0
- data/vendor/libsodium/libsodium.vcxproj.filters +569 -0
- data/vendor/libsodium/logo.png +0 -0
- data/vendor/libsodium/m4/ax_check_compile_flag.m4 +73 -0
- data/vendor/libsodium/m4/ax_check_gnu_make.m4 +78 -0
- data/vendor/libsodium/m4/ax_check_link_flag.m4 +72 -0
- data/vendor/libsodium/m4/ld-output-def.m4 +29 -0
- data/vendor/libsodium/m4/pkg.m4 +214 -0
- data/vendor/libsodium/msvc-scripts/Makefile.am +4 -0
- data/vendor/libsodium/msvc-scripts/process.bat +8 -0
- data/vendor/libsodium/msvc-scripts/rep.vbs +12 -0
- data/vendor/libsodium/msvc-scripts/sodium.props +25 -0
- data/vendor/libsodium/src/Makefile.am +3 -0
- data/vendor/libsodium/src/libsodium/Makefile.am +232 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/crypto_auth.c +34 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/api.h +10 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/hmac_hmacsha256.c +83 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/ref/verify_hmacsha256.c +9 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/api.h +10 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c +86 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c +9 -0
- data/vendor/libsodium/src/libsodium/crypto_auth/try.c +119 -0
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box.c +95 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +41 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c +22 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +19 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +19 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c +27 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +12 -0
- data/vendor/libsodium/src/libsodium/crypto_box/try.c +195 -0
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20_api.c +26 -0
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/api.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20.c +108 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/core_salsa20_api.c +26 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/api.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa20/ref/core_salsa20.c +134 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/core_salsa2012_api.c +26 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/api.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa2012/ref/core_salsa2012.c +134 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/core_salsa208_api.c +26 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/api.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_core/salsa208/ref/core_salsa208.c +134 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/generichash_blake2_api.c +31 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/api.h +4 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +132 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +169 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +364 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +355 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/generichash_blake2b.c +61 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +84 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/crypto_hash.c +9 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256_api.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/ref/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha256/ref/hash_sha256.c +69 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512_api.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/ref/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/sha512/ref/hash_sha512.c +71 -0
- data/vendor/libsodium/src/libsodium/crypto_hash/try.c +76 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/hashblocks_sha256_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/api.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha256/ref/blocks_sha256.c +212 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/hashblocks_sha512_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/api.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/sha512/ref/blocks_sha512.c +239 -0
- data/vendor/libsodium/src/libsodium/crypto_hashblocks/try.c +78 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +34 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/auth_poly1305_53.c +1661 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/53/verify_poly1305_53.c +10 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +151 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/portable-jane.h +772 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c +10 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +36 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +152 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c +34 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/api.h +9 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c +13 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +426 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/base_curve25519_ref.c +20 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c +268 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519_api.c +14 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/try.c +125 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c +48 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/try.c +129 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/api.h +12 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/ref/box_xsalsa20poly1305.c +35 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c +26 -0
- data/vendor/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c +27 -0
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24.c +91 -0
- data/vendor/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24_api.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/crypto_sign.c +61 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/description +1 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/api.h +14 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base.h +1344 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/base2.h +40 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/d2.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe.h +56 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_0.c +19 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_1.c +19 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_add.c +57 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c +63 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_copy.c +29 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c +73 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_invert.c +14 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnegative.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_isnonzero.c +19 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c +253 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_neg.c +45 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_pow22523.c +13 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c +149 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c +160 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sub.c +57 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_tobytes.c +119 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge.h +95 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_add.h +97 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_double_scalarmult.c +96 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c +50 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_madd.h +88 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_msub.h +88 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p2.c +12 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p1p1_to_p3.c +13 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_0.c +8 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p2_dbl.h +73 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_0.c +9 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_dbl.c +12 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_cached.c +17 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_to_p2.c +12 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_p3_tobytes.c +14 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_precomp_0.c +8 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +105 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.c +11 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_sub.h +97 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_tobytes.c +14 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +31 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c +40 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h +160 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h +160 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc.h +15 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c +368 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c +275 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c +38 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sqrtm1.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519_api.c +26 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/api.h +13 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519.h +54 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c +348 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519.h +34 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c +230 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519.h +51 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c +146 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c +102 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c +21 -0
- data/vendor/libsodium/src/libsodium/crypto_sign/try.c +87 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/afternm_aes128ctr.c +159 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/api.h +14 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/beforenm_aes128ctr.c +59 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common.h +788 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c +64 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts.h +28 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c +14 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +47 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +131 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/stream_aes128ctr.c +28 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/types.h +10 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c +181 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/stream_aes128ctr_api.c +21 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-be.h +274 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table-le.h +274 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes-table.h +56 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256-ctr.c +238 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/aes256.h +171 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/api.h +14 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/hongjun/ecrypt-sync.h +27 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/aes256estream/stream_aes256estream_api.c +21 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/crypto_stream.c +36 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/api.h +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +950 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/api.h +8 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +55 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +58 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/api.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012.c +51 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/ref/xor_salsa2012.c +54 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/api.h +10 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208.c +51 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/ref/xor_salsa208.c +54 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/try.c +122 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/api.h +11 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/stream_xsalsa20.c +24 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/ref/xor_xsalsa20.c +25 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20_api.c +16 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/16/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/api.h +2 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/16/ref/verify_16.c +24 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/16/verify_16_api.c +6 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/32/checksum +1 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/api.h +2 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/32/ref/verify_32.c +40 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/32/verify_32_api.c +6 -0
- data/vendor/libsodium/src/libsodium/crypto_verify/try.c +76 -0
- data/vendor/libsodium/src/libsodium/include/Makefile.am +63 -0
- data/vendor/libsodium/src/libsodium/include/sodium.h +48 -0
- data/vendor/libsodium/src/libsodium/include/sodium/core.h +18 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth.h +36 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +36 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +36 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +83 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +72 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_hsalsa20.h +40 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa20.h +40 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa2012.h +40 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_core_salsa208.h +40 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash.h +70 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +87 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +23 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +29 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +29 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha256.h +32 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hashblocks_sha512.h +32 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_int32.h +8 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_int64.h +8 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +37 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +65 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_53.h +34 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +34 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult.h +36 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in +44 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +47 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +44 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash.h +33 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +29 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign.h +61 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_ed25519.h +52 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +44 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream.h +46 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes128ctr.h +60 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +61 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h.in +54 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa2012.h +43 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa208.h +43 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +44 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint16.h +8 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint32.h +8 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint64.h +8 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_uint8.h +8 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_16.h +25 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_verify_32.h +25 -0
- data/vendor/libsodium/src/libsodium/include/sodium/export.h +32 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +53 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +45 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h +45 -0
- data/vendor/libsodium/src/libsodium/include/sodium/utils.h +36 -0
- data/vendor/libsodium/src/libsodium/include/sodium/version.h.in +29 -0
- data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +63 -0
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +317 -0
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +212 -0
- data/vendor/libsodium/src/libsodium/sodium/compat.c +248 -0
- data/vendor/libsodium/src/libsodium/sodium/core.c +21 -0
- data/vendor/libsodium/src/libsodium/sodium/utils.c +94 -0
- data/vendor/libsodium/src/libsodium/sodium/version.c +20 -0
- data/vendor/libsodium/test/Makefile.am +5 -0
- data/vendor/libsodium/test/default/Makefile.am +277 -0
- data/vendor/libsodium/test/default/auth.c +21 -0
- data/vendor/libsodium/test/default/auth.exp +4 -0
- data/vendor/libsodium/test/default/auth2.c +36 -0
- data/vendor/libsodium/test/default/auth2.exp +4 -0
- data/vendor/libsodium/test/default/auth3.c +36 -0
- data/vendor/libsodium/test/default/auth3.exp +1 -0
- data/vendor/libsodium/test/default/auth5.c +37 -0
- data/vendor/libsodium/test/default/auth5.exp +0 -0
- data/vendor/libsodium/test/default/box.c +65 -0
- data/vendor/libsodium/test/default/box.exp +19 -0
- data/vendor/libsodium/test/default/box2.c +66 -0
- data/vendor/libsodium/test/default/box2.exp +17 -0
- data/vendor/libsodium/test/default/box7.c +37 -0
- data/vendor/libsodium/test/default/box7.exp +0 -0
- data/vendor/libsodium/test/default/box8.c +44 -0
- data/vendor/libsodium/test/default/box8.exp +0 -0
- data/vendor/libsodium/test/default/cmptest.h +51 -0
- data/vendor/libsodium/test/default/core1.c +32 -0
- data/vendor/libsodium/test/default/core1.exp +4 -0
- data/vendor/libsodium/test/default/core2.c +35 -0
- data/vendor/libsodium/test/default/core2.exp +4 -0
- data/vendor/libsodium/test/default/core3.c +42 -0
- data/vendor/libsodium/test/default/core3.exp +1 -0
- data/vendor/libsodium/test/default/core4.c +35 -0
- data/vendor/libsodium/test/default/core4.exp +8 -0
- data/vendor/libsodium/test/default/core5.c +34 -0
- data/vendor/libsodium/test/default/core5.exp +4 -0
- data/vendor/libsodium/test/default/core6.c +49 -0
- data/vendor/libsodium/test/default/core6.exp +4 -0
- data/vendor/libsodium/test/default/generichash.c +27 -0
- data/vendor/libsodium/test/default/generichash.exp +64 -0
- data/vendor/libsodium/test/default/generichash2.c +31 -0
- data/vendor/libsodium/test/default/generichash2.exp +64 -0
- data/vendor/libsodium/test/default/hash.c +16 -0
- data/vendor/libsodium/test/default/hash.exp +1 -0
- data/vendor/libsodium/test/default/hash2.exp +1 -0
- data/vendor/libsodium/test/default/hash3.c +16 -0
- data/vendor/libsodium/test/default/hash3.exp +1 -0
- data/vendor/libsodium/test/default/onetimeauth.c +44 -0
- data/vendor/libsodium/test/default/onetimeauth.exp +2 -0
- data/vendor/libsodium/test/default/onetimeauth2.c +42 -0
- data/vendor/libsodium/test/default/onetimeauth2.exp +1 -0
- data/vendor/libsodium/test/default/onetimeauth7.c +37 -0
- data/vendor/libsodium/test/default/onetimeauth7.exp +0 -0
- data/vendor/libsodium/test/default/pre.js +33 -0
- data/vendor/libsodium/test/default/randombytes.c +16 -0
- data/vendor/libsodium/test/default/scalarmult.c +25 -0
- data/vendor/libsodium/test/default/scalarmult.exp +4 -0
- data/vendor/libsodium/test/default/scalarmult2.c +25 -0
- data/vendor/libsodium/test/default/scalarmult2.exp +4 -0
- data/vendor/libsodium/test/default/scalarmult5.c +32 -0
- data/vendor/libsodium/test/default/scalarmult5.exp +4 -0
- data/vendor/libsodium/test/default/scalarmult6.c +32 -0
- data/vendor/libsodium/test/default/scalarmult6.exp +4 -0
- data/vendor/libsodium/test/default/scalarmult7.c +34 -0
- data/vendor/libsodium/test/default/scalarmult7.exp +1 -0
- data/vendor/libsodium/test/default/scalarmult8.c +34 -0
- data/vendor/libsodium/test/default/scalarmult8.exp +1 -0
- data/vendor/libsodium/test/default/secretbox.c +58 -0
- data/vendor/libsodium/test/default/secretbox.exp +19 -0
- data/vendor/libsodium/test/default/secretbox2.c +59 -0
- data/vendor/libsodium/test/default/secretbox2.exp +17 -0
- data/vendor/libsodium/test/default/secretbox7.c +33 -0
- data/vendor/libsodium/test/default/secretbox7.exp +0 -0
- data/vendor/libsodium/test/default/secretbox8.c +40 -0
- data/vendor/libsodium/test/default/secretbox8.exp +0 -0
- data/vendor/libsodium/test/default/shorthash.c +23 -0
- data/vendor/libsodium/test/default/shorthash.exp +64 -0
- data/vendor/libsodium/test/default/sodium_core.c +11 -0
- data/vendor/libsodium/test/default/sodium_core.exp +1 -0
- data/vendor/libsodium/test/default/sodium_utils.c +27 -0
- data/vendor/libsodium/test/default/sodium_utils.exp +6 -0
- data/vendor/libsodium/test/default/sodium_version.c +13 -0
- data/vendor/libsodium/test/default/sodium_version.exp +3 -0
- data/vendor/libsodium/test/default/stream.c +30 -0
- data/vendor/libsodium/test/default/stream.exp +1 -0
- data/vendor/libsodium/test/default/stream2.c +28 -0
- data/vendor/libsodium/test/default/stream2.exp +1 -0
- data/vendor/libsodium/test/default/stream3.c +30 -0
- data/vendor/libsodium/test/default/stream3.exp +4 -0
- data/vendor/libsodium/test/default/stream4.c +55 -0
- data/vendor/libsodium/test/default/stream4.exp +17 -0
- data/vendor/libsodium/test/default/stream5.c +29 -0
- data/vendor/libsodium/test/default/stream5.exp +1 -0
- data/vendor/libsodium/test/default/stream6.c +54 -0
- data/vendor/libsodium/test/default/stream6.exp +17 -0
- data/vendor/libsodium/test/default/wintest.bat +56 -0
- data/vendor/libsodium/test/quirks/windows/windows-quirks.h +18 -0
- metadata +500 -0
@@ -0,0 +1 @@
|
|
1
|
+
86df8bd202b2a2b5fdc04a7f50a591e43a345849c12fef08d487109648a08e05
|
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
#include "crypto_hash_sha256.h"
|
3
|
+
|
4
|
+
#define crypto_hash crypto_hash_sha256
|
5
|
+
#define crypto_hash_BYTES crypto_hash_sha256_BYTES
|
6
|
+
#define crypto_hash_PRIMITIVE "sha256"
|
7
|
+
#define crypto_hash_IMPLEMENTATION crypto_hash_sha256_IMPLEMENTATION
|
8
|
+
#define crypto_hash_VERSION crypto_hash_sha256_VERSION
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
20080913
|
3
|
+
D. J. Bernstein
|
4
|
+
Public domain.
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "api.h"
|
8
|
+
#include "crypto_hashblocks_sha256.h"
|
9
|
+
|
10
|
+
#define blocks crypto_hashblocks_sha256
|
11
|
+
|
12
|
+
typedef unsigned int uint32;
|
13
|
+
|
14
|
+
static const unsigned char iv[32] = {
|
15
|
+
0x6a,0x09,0xe6,0x67,
|
16
|
+
0xbb,0x67,0xae,0x85,
|
17
|
+
0x3c,0x6e,0xf3,0x72,
|
18
|
+
0xa5,0x4f,0xf5,0x3a,
|
19
|
+
0x51,0x0e,0x52,0x7f,
|
20
|
+
0x9b,0x05,0x68,0x8c,
|
21
|
+
0x1f,0x83,0xd9,0xab,
|
22
|
+
0x5b,0xe0,0xcd,0x19,
|
23
|
+
} ;
|
24
|
+
|
25
|
+
int crypto_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen)
|
26
|
+
{
|
27
|
+
unsigned char h[32];
|
28
|
+
unsigned char padded[128];
|
29
|
+
unsigned long long i;
|
30
|
+
unsigned long long bits = inlen << 3;
|
31
|
+
|
32
|
+
for (i = 0;i < 32;++i) h[i] = iv[i];
|
33
|
+
|
34
|
+
blocks(h,in,inlen);
|
35
|
+
in += inlen;
|
36
|
+
inlen &= 63;
|
37
|
+
in -= inlen;
|
38
|
+
|
39
|
+
for (i = 0;i < inlen;++i) padded[i] = in[i];
|
40
|
+
padded[inlen] = 0x80;
|
41
|
+
|
42
|
+
if (inlen < 56) {
|
43
|
+
for (i = inlen + 1;i < 56;++i) padded[i] = 0;
|
44
|
+
padded[56] = bits >> 56;
|
45
|
+
padded[57] = bits >> 48;
|
46
|
+
padded[58] = bits >> 40;
|
47
|
+
padded[59] = bits >> 32;
|
48
|
+
padded[60] = bits >> 24;
|
49
|
+
padded[61] = bits >> 16;
|
50
|
+
padded[62] = bits >> 8;
|
51
|
+
padded[63] = bits;
|
52
|
+
blocks(h,padded,64);
|
53
|
+
} else {
|
54
|
+
for (i = inlen + 1;i < 120;++i) padded[i] = 0;
|
55
|
+
padded[120] = bits >> 56;
|
56
|
+
padded[121] = bits >> 48;
|
57
|
+
padded[122] = bits >> 40;
|
58
|
+
padded[123] = bits >> 32;
|
59
|
+
padded[124] = bits >> 24;
|
60
|
+
padded[125] = bits >> 16;
|
61
|
+
padded[126] = bits >> 8;
|
62
|
+
padded[127] = bits;
|
63
|
+
blocks(h,padded,128);
|
64
|
+
}
|
65
|
+
|
66
|
+
for (i = 0;i < 32;++i) out[i] = h[i];
|
67
|
+
|
68
|
+
return 0;
|
69
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
9a2a989e136a02c3362c98e6e1e0b52fab980a1dafbebe4dd5e44d15d061742e35fb686befd4e33c608d251c96e26c020f90d92bb7ec8a657f79bb8e0b00a473
|
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
#include "crypto_hash_sha512.h"
|
3
|
+
|
4
|
+
#define crypto_hash crypto_hash_sha512
|
5
|
+
#define crypto_hash_BYTES crypto_hash_sha512_BYTES
|
6
|
+
#define crypto_hash_PRIMITIVE "sha512"
|
7
|
+
#define crypto_hash_IMPLEMENTATION crypto_hash_sha512_IMPLEMENTATION
|
8
|
+
#define crypto_hash_VERSION crypto_hash_sha512_VERSION
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/*
|
2
|
+
20080913
|
3
|
+
D. J. Bernstein
|
4
|
+
Public domain.
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "api.h"
|
8
|
+
#include "crypto_hashblocks_sha512.h"
|
9
|
+
|
10
|
+
#define blocks crypto_hashblocks_sha512
|
11
|
+
|
12
|
+
static const unsigned char iv[64] = {
|
13
|
+
0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08,
|
14
|
+
0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b,
|
15
|
+
0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b,
|
16
|
+
0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1,
|
17
|
+
0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1,
|
18
|
+
0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f,
|
19
|
+
0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b,
|
20
|
+
0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79
|
21
|
+
} ;
|
22
|
+
|
23
|
+
typedef unsigned long long uint64;
|
24
|
+
|
25
|
+
int crypto_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen)
|
26
|
+
{
|
27
|
+
unsigned char h[64];
|
28
|
+
unsigned char padded[256];
|
29
|
+
unsigned long long i;
|
30
|
+
unsigned long long bytes = inlen;
|
31
|
+
|
32
|
+
for (i = 0;i < 64;++i) h[i] = iv[i];
|
33
|
+
|
34
|
+
blocks(h,in,inlen);
|
35
|
+
in += inlen;
|
36
|
+
inlen &= 127;
|
37
|
+
in -= inlen;
|
38
|
+
|
39
|
+
for (i = 0;i < inlen;++i) padded[i] = in[i];
|
40
|
+
padded[inlen] = 0x80;
|
41
|
+
|
42
|
+
if (inlen < 112) {
|
43
|
+
for (i = inlen + 1;i < 119;++i) padded[i] = 0;
|
44
|
+
padded[119] = bytes >> 61;
|
45
|
+
padded[120] = bytes >> 53;
|
46
|
+
padded[121] = bytes >> 45;
|
47
|
+
padded[122] = bytes >> 37;
|
48
|
+
padded[123] = bytes >> 29;
|
49
|
+
padded[124] = bytes >> 21;
|
50
|
+
padded[125] = bytes >> 13;
|
51
|
+
padded[126] = bytes >> 5;
|
52
|
+
padded[127] = bytes << 3;
|
53
|
+
blocks(h,padded,128);
|
54
|
+
} else {
|
55
|
+
for (i = inlen + 1;i < 247;++i) padded[i] = 0;
|
56
|
+
padded[247] = bytes >> 61;
|
57
|
+
padded[248] = bytes >> 53;
|
58
|
+
padded[249] = bytes >> 45;
|
59
|
+
padded[250] = bytes >> 37;
|
60
|
+
padded[251] = bytes >> 29;
|
61
|
+
padded[252] = bytes >> 21;
|
62
|
+
padded[253] = bytes >> 13;
|
63
|
+
padded[254] = bytes >> 5;
|
64
|
+
padded[255] = bytes << 3;
|
65
|
+
blocks(h,padded,256);
|
66
|
+
}
|
67
|
+
|
68
|
+
for (i = 0;i < 64;++i) out[i] = h[i];
|
69
|
+
|
70
|
+
return 0;
|
71
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/*
|
2
|
+
* crypto_hash/try.c version 20090118
|
3
|
+
* D. J. Bernstein
|
4
|
+
* Public domain.
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include <stdlib.h>
|
8
|
+
#include "crypto_hash.h"
|
9
|
+
#include "utils.h"
|
10
|
+
#include "windows/windows-quirks.h"
|
11
|
+
|
12
|
+
extern unsigned char *alignedcalloc(unsigned long long);
|
13
|
+
|
14
|
+
const char *primitiveimplementation = crypto_hash_IMPLEMENTATION;
|
15
|
+
|
16
|
+
#define MAXTEST_BYTES (10000 + crypto_hash_BYTES)
|
17
|
+
#define CHECKSUM_BYTES 4096
|
18
|
+
#define TUNE_BYTES 1536
|
19
|
+
|
20
|
+
static unsigned char *h;
|
21
|
+
static unsigned char *h2;
|
22
|
+
static unsigned char *m;
|
23
|
+
static unsigned char *m2;
|
24
|
+
|
25
|
+
void preallocate(void)
|
26
|
+
{
|
27
|
+
}
|
28
|
+
|
29
|
+
void allocate(void)
|
30
|
+
{
|
31
|
+
h = alignedcalloc(crypto_hash_BYTES);
|
32
|
+
h2 = alignedcalloc(crypto_hash_BYTES);
|
33
|
+
m = alignedcalloc(MAXTEST_BYTES);
|
34
|
+
m2 = alignedcalloc(MAXTEST_BYTES);
|
35
|
+
}
|
36
|
+
|
37
|
+
void predoit(void)
|
38
|
+
{
|
39
|
+
}
|
40
|
+
|
41
|
+
void doit(void)
|
42
|
+
{
|
43
|
+
crypto_hash(h,m,TUNE_BYTES);
|
44
|
+
}
|
45
|
+
|
46
|
+
char checksum[crypto_hash_BYTES * 2 + 1];
|
47
|
+
|
48
|
+
const char *checksum_compute(void)
|
49
|
+
{
|
50
|
+
long long i;
|
51
|
+
long long j;
|
52
|
+
|
53
|
+
for (i = 0;i < CHECKSUM_BYTES;++i) {
|
54
|
+
long long hlen = crypto_hash_BYTES;
|
55
|
+
long long mlen = i;
|
56
|
+
for (j = -16;j < 0;++j) h[j] = rand();
|
57
|
+
for (j = hlen;j < hlen + 16;++j) h[j] = rand();
|
58
|
+
for (j = -16;j < hlen + 16;++j) h2[j] = h[j];
|
59
|
+
for (j = -16;j < 0;++j) m[j] = rand();
|
60
|
+
for (j = mlen;j < mlen + 16;++j) m[j] = rand();
|
61
|
+
for (j = -16;j < mlen + 16;++j) m2[j] = m[j];
|
62
|
+
if (crypto_hash(h,m,mlen) != 0) return "crypto_hash returns nonzero";
|
63
|
+
for (j = -16;j < mlen + 16;++j) if (m2[j] != m[j]) return "crypto_hash writes to input";
|
64
|
+
for (j = -16;j < 0;++j) if (h2[j] != h[j]) return "crypto_hash writes before output";
|
65
|
+
for (j = hlen;j < hlen + 16;++j) if (h2[j] != h[j]) return "crypto_hash writes after output";
|
66
|
+
if (crypto_hash(m2,m2,mlen) != 0) return "crypto_hash returns nonzero";
|
67
|
+
for (j = 0;j < hlen;++j) if (m2[j] != h[j]) return "crypto_hash does not handle overlap";
|
68
|
+
for (j = 0;j < mlen;++j) m[j] ^= h[j % hlen];
|
69
|
+
m[mlen] = h[0];
|
70
|
+
}
|
71
|
+
if (crypto_hash(h,m,CHECKSUM_BYTES) != 0) return "crypto_hash returns nonzero";
|
72
|
+
|
73
|
+
sodium_bin2hex(checksum, sizeof checksum, h, crypto_hash_BYTES);
|
74
|
+
|
75
|
+
return 0;
|
76
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
69a9dc2464f9593161e462d3dbb634b84f1d68d67d26df29aaa805f9dcd8f656
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#include "crypto_hashblocks_sha256.h"
|
2
|
+
|
3
|
+
size_t
|
4
|
+
crypto_hashblocks_sha256_statebytes(void) {
|
5
|
+
return crypto_hashblocks_sha256_STATEBYTES;
|
6
|
+
}
|
7
|
+
|
8
|
+
size_t
|
9
|
+
crypto_hashblocks_sha256_blockbytes(void) {
|
10
|
+
return crypto_hashblocks_sha256_BLOCKBYTES;
|
11
|
+
}
|
12
|
+
|
13
|
+
const char *
|
14
|
+
crypto_hashblocks_sha256_primitive(void) {
|
15
|
+
return "sha256";
|
16
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
#include "crypto_hashblocks_sha256.h"
|
3
|
+
|
4
|
+
#define crypto_hashblocks crypto_hashblocks_sha256
|
5
|
+
#define crypto_hashblocks_STATEBYTES crypto_hashblocks_sha256_STATEBYTES
|
6
|
+
#define crypto_hashblocks_BLOCKBYTES crypto_hashblocks_sha256_BLOCKBYTES
|
7
|
+
#define crypto_hashblocks_PRIMITIVE "sha256"
|
8
|
+
#define crypto_hashblocks_IMPLEMENTATION crypto_hashblocks_sha256_IMPLEMENTATION
|
9
|
+
#define crypto_hashblocks_VERSION crypto_hashblocks_sha256_VERSION
|
@@ -0,0 +1,212 @@
|
|
1
|
+
#include "api.h"
|
2
|
+
|
3
|
+
typedef unsigned int uint32;
|
4
|
+
|
5
|
+
static uint32 load_bigendian(const unsigned char *x)
|
6
|
+
{
|
7
|
+
return
|
8
|
+
(uint32) (x[3]) \
|
9
|
+
| (((uint32) (x[2])) << 8) \
|
10
|
+
| (((uint32) (x[1])) << 16) \
|
11
|
+
| (((uint32) (x[0])) << 24)
|
12
|
+
;
|
13
|
+
}
|
14
|
+
|
15
|
+
static void store_bigendian(unsigned char *x,uint32 u)
|
16
|
+
{
|
17
|
+
x[3] = u; u >>= 8;
|
18
|
+
x[2] = u; u >>= 8;
|
19
|
+
x[1] = u; u >>= 8;
|
20
|
+
x[0] = u;
|
21
|
+
}
|
22
|
+
|
23
|
+
#define SHR(x,c) ((x) >> (c))
|
24
|
+
#define ROTR(x,c) (((x) >> (c)) | ((x) << (32 - (c))))
|
25
|
+
|
26
|
+
#define Ch(x,y,z) ((x & y) ^ (~x & z))
|
27
|
+
#define Maj(x,y,z) ((x & y) ^ (x & z) ^ (y & z))
|
28
|
+
#define Sigma0(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
|
29
|
+
#define Sigma1(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
|
30
|
+
#define sigma0(x) (ROTR(x, 7) ^ ROTR(x,18) ^ SHR(x, 3))
|
31
|
+
#define sigma1(x) (ROTR(x,17) ^ ROTR(x,19) ^ SHR(x,10))
|
32
|
+
|
33
|
+
#define M(w0,w14,w9,w1) w0 = sigma1(w14) + w9 + sigma0(w1) + w0;
|
34
|
+
|
35
|
+
#define EXPAND \
|
36
|
+
M(w0 ,w14,w9 ,w1 ) \
|
37
|
+
M(w1 ,w15,w10,w2 ) \
|
38
|
+
M(w2 ,w0 ,w11,w3 ) \
|
39
|
+
M(w3 ,w1 ,w12,w4 ) \
|
40
|
+
M(w4 ,w2 ,w13,w5 ) \
|
41
|
+
M(w5 ,w3 ,w14,w6 ) \
|
42
|
+
M(w6 ,w4 ,w15,w7 ) \
|
43
|
+
M(w7 ,w5 ,w0 ,w8 ) \
|
44
|
+
M(w8 ,w6 ,w1 ,w9 ) \
|
45
|
+
M(w9 ,w7 ,w2 ,w10) \
|
46
|
+
M(w10,w8 ,w3 ,w11) \
|
47
|
+
M(w11,w9 ,w4 ,w12) \
|
48
|
+
M(w12,w10,w5 ,w13) \
|
49
|
+
M(w13,w11,w6 ,w14) \
|
50
|
+
M(w14,w12,w7 ,w15) \
|
51
|
+
M(w15,w13,w8 ,w0 )
|
52
|
+
|
53
|
+
#define F(w,k) \
|
54
|
+
T1 = h + Sigma1(e) + Ch(e,f,g) + k + w; \
|
55
|
+
T2 = Sigma0(a) + Maj(a,b,c); \
|
56
|
+
h = g; \
|
57
|
+
g = f; \
|
58
|
+
f = e; \
|
59
|
+
e = d + T1; \
|
60
|
+
d = c; \
|
61
|
+
c = b; \
|
62
|
+
b = a; \
|
63
|
+
a = T1 + T2;
|
64
|
+
|
65
|
+
int crypto_hashblocks(unsigned char *statebytes,const unsigned char *in,unsigned long long inlen)
|
66
|
+
{
|
67
|
+
uint32 state[8];
|
68
|
+
uint32 a;
|
69
|
+
uint32 b;
|
70
|
+
uint32 c;
|
71
|
+
uint32 d;
|
72
|
+
uint32 e;
|
73
|
+
uint32 f;
|
74
|
+
uint32 g;
|
75
|
+
uint32 h;
|
76
|
+
uint32 T1;
|
77
|
+
uint32 T2;
|
78
|
+
|
79
|
+
a = load_bigendian(statebytes + 0); state[0] = a;
|
80
|
+
b = load_bigendian(statebytes + 4); state[1] = b;
|
81
|
+
c = load_bigendian(statebytes + 8); state[2] = c;
|
82
|
+
d = load_bigendian(statebytes + 12); state[3] = d;
|
83
|
+
e = load_bigendian(statebytes + 16); state[4] = e;
|
84
|
+
f = load_bigendian(statebytes + 20); state[5] = f;
|
85
|
+
g = load_bigendian(statebytes + 24); state[6] = g;
|
86
|
+
h = load_bigendian(statebytes + 28); state[7] = h;
|
87
|
+
|
88
|
+
while (inlen >= 64) {
|
89
|
+
uint32 w0 = load_bigendian(in + 0);
|
90
|
+
uint32 w1 = load_bigendian(in + 4);
|
91
|
+
uint32 w2 = load_bigendian(in + 8);
|
92
|
+
uint32 w3 = load_bigendian(in + 12);
|
93
|
+
uint32 w4 = load_bigendian(in + 16);
|
94
|
+
uint32 w5 = load_bigendian(in + 20);
|
95
|
+
uint32 w6 = load_bigendian(in + 24);
|
96
|
+
uint32 w7 = load_bigendian(in + 28);
|
97
|
+
uint32 w8 = load_bigendian(in + 32);
|
98
|
+
uint32 w9 = load_bigendian(in + 36);
|
99
|
+
uint32 w10 = load_bigendian(in + 40);
|
100
|
+
uint32 w11 = load_bigendian(in + 44);
|
101
|
+
uint32 w12 = load_bigendian(in + 48);
|
102
|
+
uint32 w13 = load_bigendian(in + 52);
|
103
|
+
uint32 w14 = load_bigendian(in + 56);
|
104
|
+
uint32 w15 = load_bigendian(in + 60);
|
105
|
+
|
106
|
+
F(w0 ,0x428a2f98)
|
107
|
+
F(w1 ,0x71374491)
|
108
|
+
F(w2 ,0xb5c0fbcf)
|
109
|
+
F(w3 ,0xe9b5dba5)
|
110
|
+
F(w4 ,0x3956c25b)
|
111
|
+
F(w5 ,0x59f111f1)
|
112
|
+
F(w6 ,0x923f82a4)
|
113
|
+
F(w7 ,0xab1c5ed5)
|
114
|
+
F(w8 ,0xd807aa98)
|
115
|
+
F(w9 ,0x12835b01)
|
116
|
+
F(w10,0x243185be)
|
117
|
+
F(w11,0x550c7dc3)
|
118
|
+
F(w12,0x72be5d74)
|
119
|
+
F(w13,0x80deb1fe)
|
120
|
+
F(w14,0x9bdc06a7)
|
121
|
+
F(w15,0xc19bf174)
|
122
|
+
|
123
|
+
EXPAND
|
124
|
+
|
125
|
+
F(w0 ,0xe49b69c1)
|
126
|
+
F(w1 ,0xefbe4786)
|
127
|
+
F(w2 ,0x0fc19dc6)
|
128
|
+
F(w3 ,0x240ca1cc)
|
129
|
+
F(w4 ,0x2de92c6f)
|
130
|
+
F(w5 ,0x4a7484aa)
|
131
|
+
F(w6 ,0x5cb0a9dc)
|
132
|
+
F(w7 ,0x76f988da)
|
133
|
+
F(w8 ,0x983e5152)
|
134
|
+
F(w9 ,0xa831c66d)
|
135
|
+
F(w10,0xb00327c8)
|
136
|
+
F(w11,0xbf597fc7)
|
137
|
+
F(w12,0xc6e00bf3)
|
138
|
+
F(w13,0xd5a79147)
|
139
|
+
F(w14,0x06ca6351)
|
140
|
+
F(w15,0x14292967)
|
141
|
+
|
142
|
+
EXPAND
|
143
|
+
|
144
|
+
F(w0 ,0x27b70a85)
|
145
|
+
F(w1 ,0x2e1b2138)
|
146
|
+
F(w2 ,0x4d2c6dfc)
|
147
|
+
F(w3 ,0x53380d13)
|
148
|
+
F(w4 ,0x650a7354)
|
149
|
+
F(w5 ,0x766a0abb)
|
150
|
+
F(w6 ,0x81c2c92e)
|
151
|
+
F(w7 ,0x92722c85)
|
152
|
+
F(w8 ,0xa2bfe8a1)
|
153
|
+
F(w9 ,0xa81a664b)
|
154
|
+
F(w10,0xc24b8b70)
|
155
|
+
F(w11,0xc76c51a3)
|
156
|
+
F(w12,0xd192e819)
|
157
|
+
F(w13,0xd6990624)
|
158
|
+
F(w14,0xf40e3585)
|
159
|
+
F(w15,0x106aa070)
|
160
|
+
|
161
|
+
EXPAND
|
162
|
+
|
163
|
+
F(w0 ,0x19a4c116)
|
164
|
+
F(w1 ,0x1e376c08)
|
165
|
+
F(w2 ,0x2748774c)
|
166
|
+
F(w3 ,0x34b0bcb5)
|
167
|
+
F(w4 ,0x391c0cb3)
|
168
|
+
F(w5 ,0x4ed8aa4a)
|
169
|
+
F(w6 ,0x5b9cca4f)
|
170
|
+
F(w7 ,0x682e6ff3)
|
171
|
+
F(w8 ,0x748f82ee)
|
172
|
+
F(w9 ,0x78a5636f)
|
173
|
+
F(w10,0x84c87814)
|
174
|
+
F(w11,0x8cc70208)
|
175
|
+
F(w12,0x90befffa)
|
176
|
+
F(w13,0xa4506ceb)
|
177
|
+
F(w14,0xbef9a3f7)
|
178
|
+
F(w15,0xc67178f2)
|
179
|
+
|
180
|
+
a += state[0];
|
181
|
+
b += state[1];
|
182
|
+
c += state[2];
|
183
|
+
d += state[3];
|
184
|
+
e += state[4];
|
185
|
+
f += state[5];
|
186
|
+
g += state[6];
|
187
|
+
h += state[7];
|
188
|
+
|
189
|
+
state[0] = a;
|
190
|
+
state[1] = b;
|
191
|
+
state[2] = c;
|
192
|
+
state[3] = d;
|
193
|
+
state[4] = e;
|
194
|
+
state[5] = f;
|
195
|
+
state[6] = g;
|
196
|
+
state[7] = h;
|
197
|
+
|
198
|
+
in += 64;
|
199
|
+
inlen -= 64;
|
200
|
+
}
|
201
|
+
|
202
|
+
store_bigendian(statebytes + 0,state[0]);
|
203
|
+
store_bigendian(statebytes + 4,state[1]);
|
204
|
+
store_bigendian(statebytes + 8,state[2]);
|
205
|
+
store_bigendian(statebytes + 12,state[3]);
|
206
|
+
store_bigendian(statebytes + 16,state[4]);
|
207
|
+
store_bigendian(statebytes + 20,state[5]);
|
208
|
+
store_bigendian(statebytes + 24,state[6]);
|
209
|
+
store_bigendian(statebytes + 28,state[7]);
|
210
|
+
|
211
|
+
return 0;
|
212
|
+
}
|