krypto

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 3 Imported by: 3

README

krypto

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.

LICNESE

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.

Performance

Usage

Todo

TODO

  • Supoorts Post-Quantum Cryptography

Documentation

Overview

Package krypto collects cryptographic algorithms designed in Republic of Korea

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHash

func RegisterHash(h KryptoHash, f func() hash.Hash)

RegisterHash registers a function that returns a new instance of the given hash function. This is intended to be called from the init function in packages that implement hash functions.

Types

type KryptoHash

type KryptoHash uint

Hash identifies a cryptographic hash function that is implemented in another package.

const (
	HAS160     KryptoHash // import github.com/RyuaNerin/go-krypto/has160
	LSH256_224            // import github.com/RyuaNerin/go-krypto/lsh256
	LSH256                // import github.com/RyuaNerin/go-krypto/lsh256
	LSH512_224            // import github.com/RyuaNerin/go-krypto/lsh512
	LSH512_256            // import github.com/RyuaNerin/go-krypto/lsh512
	LSH512_384            // import github.com/RyuaNerin/go-krypto/lsh512
	LSH512                // import github.com/RyuaNerin/go-krypto/lsh512

)

func (KryptoHash) Available

func (h KryptoHash) Available() bool

Available reports whether the given hash function is linked into the binary.

func (KryptoHash) New

func (h KryptoHash) New() hash.Hash

New returns a new hash.Hash calculating the given hash function. New panics if the hash function is not linked into the binary.

func (KryptoHash) Size

func (h KryptoHash) Size() int

func (KryptoHash) String

func (h KryptoHash) String() string

Directories

Path Synopsis
Package aria implements ARIA encryption, as defined in KS X 1213-1
Package aria implements ARIA encryption, as defined in KS X 1213-1
Package cmac implements CMAC(Cipher Message Authentication Code) as defined in NIST SP 800-38B, KS X ISO/IEC 9797-1.
Package cmac implements CMAC(Cipher Message Authentication Code) as defined in NIST SP 800-38B, KS X ISO/IEC 9797-1.
cmd
drbg implemented deterministic random bit generator as defined in TTAK.KO-12.0331, TTAK.KO-12.0332, TTAK.KO-12.0189/R1, NIST SP 800-90A.
drbg implemented deterministic random bit generator as defined in TTAK.KO-12.0331, TTAK.KO-12.0332, TTAK.KO-12.0189/R1, NIST SP 800-90A.
Package eckcdsa implements the EC-KCDSA(Korean Certificate-based Digital Signature Algorithm using Elliptic Curves) as defined in TTAK.KO-12.0015/R3
Package eckcdsa implements the EC-KCDSA(Korean Certificate-based Digital Signature Algorithm using Elliptic Curves) as defined in TTAK.KO-12.0015/R3
Pakcage gmac implements a Galois/Counter Mode (GCM) based MAC, as defined in KS X ISO/IEC 9797-3, NIST SP 800-38D.
Pakcage gmac implements a Galois/Counter Mode (GCM) based MAC, as defined in KS X ISO/IEC 9797-3, NIST SP 800-38D.
Package has160 implements HAS-160 encryption, as defined in TTAS.KO-12.0011/R2
Package has160 implements HAS-160 encryption, as defined in TTAS.KO-12.0011/R2
Package hight implements HIGHT encryption, as defined in TTAS.KO-12.0040/R1
Package hight implements HIGHT encryption, as defined in TTAS.KO-12.0040/R1
alias
Package alias implements memory aliasing tests.
Package alias implements memory aliasing tests.
golang.org/x/crypto/cryptobyte
Package cryptobyte contains types that help with parsing and constructing length-prefixed, binary messages, including ASN.1 DER.
Package cryptobyte contains types that help with parsing and constructing length-prefixed, binary messages, including ASN.1 DER.
golang.org/x/crypto/cryptobyte/asn1
Package asn1 contains supporting types for parsing and building ASN.1 messages with the cryptobyte package.
Package asn1 contains supporting types for parsing and building ASN.1 messages with the cryptobyte package.
golang.org/x/sys/cpu
Package cpu implements processor feature detection for various CPU architectures.
Package cpu implements processor feature detection for various CPU architectures.
randutil
Package randutil contains internal randomness utilities for various crypto packages.
Package randutil contains internal randomness utilities for various crypto packages.
Package kbkdf implements Key Based Key Derivation Functions, as defined in TTAK.KO-12.0272, TTAK.KO-12.0333, NIST SP 800-108.
Package kbkdf implements Key Based Key Derivation Functions, as defined in TTAK.KO-12.0272, TTAK.KO-12.0333, NIST SP 800-108.
Package kcdsa implements the KCDSA(Korean Certificate-based Digital Signature Algorithm) as defined in TTAK.KO-12.0001/R4
Package kcdsa implements the KCDSA(Korean Certificate-based Digital Signature Algorithm) as defined in TTAK.KO-12.0001/R4
Package kipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations.
Package kipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations.
Pakcage kx509 supports marshaling and unmarshaling of EC-KCDSA and KCDSA private/public keys.
Pakcage kx509 supports marshaling and unmarshaling of EC-KCDSA and KCDSA private/public keys.
Package lea implements LEA encryption, as defined in TTAK.KO-12.0223
Package lea implements LEA encryption, as defined in TTAK.KO-12.0223
Package lsh256 implements the LSH-256, LSH-256-224 hash algorithms as defined in KS X 3262
Package lsh256 implements the LSH-256, LSH-256-224 hash algorithms as defined in KS X 3262
Package lsh512 implements the LSH-512, LSH-384, LSH-512-256, LSH-512-224 hash algorithms as defined in KS X 3262
Package lsh512 implements the LSH-512, LSH-384, LSH-512-256, LSH-512-224 hash algorithms as defined in KS X 3262
Package pbkdf2 implements HMAC-based Key Derivation Functions, as defined in TTAK.KO-12.0334, NIST SP 800-132, RFC 2898(PKCS #5)
Package pbkdf2 implements HMAC-based Key Derivation Functions, as defined in TTAK.KO-12.0334, NIST SP 800-132, RFC 2898(PKCS #5)
Package seed implements SEED encryption, as defined in TTAS.KO-12.0004/R1
Package seed implements SEED encryption, as defined in TTAS.KO-12.0004/R1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL