github.com/RyuaNerin/go-krypto

go cryptographic library collects algorithms designed in Republic of Korea (SEED, ARIA, HIGHT, LEA, HAS160, LSH256, LSH512, KCDSA, EC-KCDSA)


Keywords
aria, cipher, cryptography, ctr-drbg, drbg, eckcdsa, has160, hash, hash-drbg, hight, hmac-drbg, kbkdf, kcdsa, kisa, lea, lsh256, lsh512, pbkdf, seed, seed128
License
MIT
Install
go get github.com/RyuaNerin/go-krypto

Documentation

PkgGoDev

  • Golang implementation of cryptographic algorithms designed in Republic of Korea

  • It is intended for compatibility with go's crypto package.

  • krypto supports SIMD for some algorithms.

Installation

go get -v "github.com/RyuaNerin/go-krypto"
package main

import (
    ...
    krypto "github.com/RyuaNerin/go-krypto"
    ...
)

Supports

Block Cipher Supports

Algorithm Package Reference 128 192 256 SIMD Supports
SEED-128 krypto/seed TTAS.KO-12.0004/R1 O
HIGHT krypto/hight TTAS.KO-12.0040/R1 O
ARIA krypto/aria KS X 1213-1 O O O arm64(NEON), amd64(SSSE3)
LEA krypto/lea TTAK.KO-12.0223 O O O arm64(NEON), amd64(SSE2, AVX2)
  • package lea supports 4-block(SSE2) and 8-block(AVX2) ECB processing.
    • Supports high performance processing when 4 or more blocks in ECB, CBC, CFB(decryption), and CTR.

Block Cipher Mode Supports

  • pakcage krypto/kipher support block cipher mode.

    • crypto/cipher package is available too.
Mode Name Reference SIMD Supports Comment
Block ECB (Electronic Codebook) NIST SP 800-38A krypto/lea
Block CBC (Cipher-Block Chaining) NIST SP 800-38A same with crypto/cipher
Block CFB (Cipher Feedback) NIST SP 800-38A krypto/lea (decrypt) Supports CFB-8, CFG-32, ...
Block OFB (Output Feedback) NIST SP 800-38A krypto/lea same with crypto/cipher
Block CTR (Counter) NIST SP 800-38A
AEAD CCM (Counter with CBC-MAC) NIST SP 800-38C
AEAD GCM (Galois/Counter Mode) NIST SP 800-38D arm64(PMULL), amd64(PCLMULQDQ)

Hash Function Supports

Algorithm Package Reference 160 224 256 384 512 SIMD Supports
HAS-160 krypto/has160 TTAS.KO-12.0011/R2 O
LSH-256 krypto/lsh256 KS X 3262 O O arm64(NEON), amd64(SSE2, SSSE3, AVX2)
LSH-512 krypto/lsh512 KS X 3262 O O O O arm64(NEON), amd64(SSE2, SSSE3, AVX2)

Digital Signature Supports

Algorithm Package Reference
KCDSA krypto/kcdsa TTAK.KO-12.0001/R4
EC-KCDSA krypto/eckcdsa TTAK.KO-12.0015/R3
  • use krypto/kx509 for marshaling and unmarshaling of the private/public key.

    Algorithm Format Reference Comment
    KCDSA PKIX, PKCS#8 NO NORMATIVE Compatibility tested with jCastle
    EC-KCDSA PKIX, PKCS#8 NO NORMATIVE Compatibility tested with botan
    EC-KCDSA SEC 1, ASN.1 DER form NO NORMATIVE

Message Authentication Code Supports

Algorithm Package Reference
CMAC krypto/cmac KS X ISO/IEC 9797-1, NIST SP 800-38B
GMAC krypto/gmac KS X ISO/IEC 9797-3, NIST SP 800-38D
  • use crypto/hmac for HMAC.

Random Number Generator Supports

Algorithm Package Reference
Hash_DRBG krypto/drbg TTAK.KO-12.0331, NIST SP 800-90A
HMAC_DRBG krypto/drbg TTAK.KO-12.0332, NIST SP 800-90A
CTR_DRBG krypto/drbg TTAK.KO-12.0189/R1, NIST SP 800-90A

Key Derivation Function Supports

Algorithm Package - Reference
KBKDF (CMAC) krypto/kbkdf TTAK.KO-12.0272, NIST SP 800-108
KBKDF (HMAC) krypto/kbkdf TTAK.KO-12.0333, NIST SP 800-108
PBKDF2 (HMAC) krypto/pbkdf2 TTAK.KO-12.0334, NIST SP 800-132, RFC 2898(PKCS #5)

Referernces

Algorithm SIMD Supports Reference
ARIA arm64(NEON), amd64(SSSE3) CRYPTOPP 8.8.0 - aria_simd.cpp
LEA arm64(NEON), amd64(SSE2, AVX2) KISA
LSH-256 arm64(NEON), amd64(SSE2, SSSE3, AVX2) KISA
LSH-512 arm64(NEON), amd64(SSE2, SSSE3, AVX2) KISA
GCM arm64(PMULL), amd64(PCLMULQDQ) package crypto/aes
krypto/internal/golang.org/x/crypto/cryptobyte package x/crypto/cryptobyte
krypto/internal/golang.org/x/sys/cpu package x/sys
  • The draft of the assembly code was created by clang and modifying verseion of the program below on MacMini M1.

Usage

Todo

TODO

  • Supoorts Post-Quantum Cryptography