core/crypto: Exile keccak, md5 and sha1 to legacy

In an perfect world these would just be removed, but the world is
imperfect, and people are forced to interact/interface with things
that are broken.
This commit is contained in:
Yawning Angel
2023-11-17 19:18:45 +09:00
parent 4587a55486
commit 59950bcad6
14 changed files with 42 additions and 22 deletions

View File

@@ -10,13 +10,13 @@ Please see the chart below for the options.
|:-------------------------------------------------------------------------------------------------------------|:-----------------|
| [BLAKE2B](https://datatracker.ietf.org/doc/html/rfc7693) | ✔️ |
| [BLAKE2S](https://datatracker.ietf.org/doc/html/rfc7693) | ✔️ |
| [Keccak](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | ✔️ |
| [MD5](https://datatracker.ietf.org/doc/html/rfc1321) | ✔️ |
| [SHA-1](https://datatracker.ietf.org/doc/html/rfc3174) | ✔️ |
| [SHA-2](https://csrc.nist.gov/csrc/media/publications/fips/180/2/archive/2002-08-01/documents/fips180-2.pdf) | ✔️ |
| [SHA-3](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | ✔️ |
| [SHAKE](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | ✔️ |
| [SM3](https://datatracker.ietf.org/doc/html/draft-sca-cfrg-sm3-02) | ✔️ |
| legacy/[Keccak](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | ✔️ |
| legacy/[MD5](https://datatracker.ietf.org/doc/html/rfc1321) | ✔️ |
| legacy/[SHA-1](https://datatracker.ietf.org/doc/html/rfc3174) | ✔️ |
#### High level API
Each hash algorithm contains a procedure group named `hash`, or if the algorithm provides more than one digest size `hash_<size>`\*.

View File

@@ -0,0 +1,10 @@
# crypto/legacy
These are algorithms that are shipped solely for the purpose of
interoperability with legacy systems. The use of these packages in
any other capacity is discouraged, especially those that are known
to be broken.
- keccak - The draft version of the algorithm that became SHA-3
- MD5 - Broken (https://eprint.iacr.org/2005/075)
- SHA-1 - Broken (https://eprint.iacr.org/2017/190)

View File

@@ -14,7 +14,7 @@ package keccak
import "core:io"
import "core:os"
import "../_sha3"
import "../../_sha3"
/*
High level API

View File

@@ -27,10 +27,10 @@ import blake2b "core:crypto/blake2b"
import blake2s "core:crypto/blake2s"
import chacha20 "core:crypto/chacha20"
import chacha20poly1305 "core:crypto/chacha20poly1305"
import keccak "core:crypto/keccak"
import md5 "core:crypto/md5"
import keccak "core:crypto/legacy/keccak"
import md5 "core:crypto/legacy/md5"
import sha1 "core:crypto/legacy/sha1"
import poly1305 "core:crypto/poly1305"
import sha1 "core:crypto/sha1"
import sha2 "core:crypto/sha2"
import sha3 "core:crypto/sha3"
import shake "core:crypto/shake"

View File

@@ -2,9 +2,9 @@ package all
import botan_bindings "vendor:botan/bindings"
import botan_blake2b "vendor:botan/blake2b"
import keccak "vendor:botan/keccak"
import md5 "vendor:botan/md5"
import sha1 "vendor:botan/sha1"
import keccak "vendor:botan/legacy/keccak"
import md5 "vendor:botan/legacy/md5"
import sha1 "vendor:botan/legacy/sha1"
import sha2 "vendor:botan/sha2"
import sha3 "vendor:botan/sha3"
import shake "vendor:botan/shake"

View File

@@ -16,16 +16,16 @@ import "core:testing"
import "core:fmt"
import "core:strings"
import "core:crypto/md5"
import "core:crypto/sha1"
import "core:crypto/sha2"
import "core:crypto/sha3"
import "core:crypto/keccak"
import "core:crypto/shake"
import "core:crypto/blake2b"
import "core:crypto/blake2s"
import "core:crypto/sm3"
import "core:crypto/siphash"
import "core:crypto/legacy/keccak"
import "core:crypto/legacy/md5"
import "core:crypto/legacy/sha1"
import "core:os"
TEST_count := 0

View File

@@ -17,11 +17,11 @@ import "core:fmt"
import "core:os"
import "core:strings"
import "vendor:botan/md5"
import "vendor:botan/sha1"
import "vendor:botan/legacy/md5"
import "vendor:botan/legacy/sha1"
import "vendor:botan/sha2"
import "vendor:botan/sha3"
import "vendor:botan/keccak"
import "vendor:botan/legacy/keccak"
import "vendor:botan/shake"
import "vendor:botan/blake2b"
import "vendor:botan/sm3"

View File

@@ -9,13 +9,13 @@ Wrappers for hashing algorithms have been added to match the API within the Odin
| Algorithm | |
|:-------------------------------------------------------------------------------------------------------------|:-----------------|
| [BLAKE2B](https://datatracker.ietf.org/doc/html/rfc7693) | &#10004;&#65039; |
| [Keccak](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | &#10004;&#65039; |
| [MD5](https://datatracker.ietf.org/doc/html/rfc1321) | &#10004;&#65039; |
| [SHA-1](https://datatracker.ietf.org/doc/html/rfc3174) | &#10004;&#65039; |
| [SHA-2](https://csrc.nist.gov/csrc/media/publications/fips/180/2/archive/2002-08-01/documents/fips180-2.pdf) | &#10004;&#65039; |
| [SHA-3](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | &#10004;&#65039; |
| [SHAKE](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | &#10004;&#65039; |
| [SM3](https://datatracker.ietf.org/doc/html/draft-sca-cfrg-sm3-02) | &#10004;&#65039; |
| legacy/[Keccak](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf) | &#10004;&#65039; |
| legacy/[MD5](https://datatracker.ietf.org/doc/html/rfc1321) | &#10004;&#65039; |
| legacy/[SHA-1](https://datatracker.ietf.org/doc/html/rfc3174) | &#10004;&#65039; |
#### High level API
Each hash algorithm contains a procedure group named `hash`, or if the algorithm provides more than one digest size `hash_<size>`.

10
vendor/botan/legacy/README.md vendored Normal file
View File

@@ -0,0 +1,10 @@
# crypto/legacy
These are algorithms that are shipped solely for the purpose of
interoperability with legacy systems. The use of these packages in
any other capacity is discouraged, especially those that are known
to be broken.
- keccak - The draft version of the algorithm that became SHA-3
- MD5 - Broken (https://eprint.iacr.org/2005/075)
- SHA-1 - Broken (https://eprint.iacr.org/2017/190)

View File

@@ -14,7 +14,7 @@ package vendor_keccak
import "core:os"
import "core:io"
import botan "../bindings"
import botan "../../bindings"
/*
High level API

View File

@@ -14,7 +14,7 @@ package vendor_md5
import "core:os"
import "core:io"
import botan "../bindings"
import botan "../../bindings"
/*
High level API

View File

@@ -14,7 +14,7 @@ package vendor_sha1
import "core:os"
import "core:io"
import botan "../bindings"
import botan "../../bindings"
/*
High level API