cryptogo

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 20 Imported by: 7

README

crypto-go

Go library of crypto standards.

Installation

To install crypto-go, use go get:

go get github.com/trumanwong/cryptogo

Usage

package yours

import (
	"fmt"
	"trumanwong/cryptogo"
)

func main()  {
    fmt.Println(cryptogo.MD5("message"))
}

Finished encrypt functions

  • md5
  • sha1
  • sha224
  • sha256
  • sha384
  • sha512
  • sha3-224
  • sha3-256
  • sha3-384
  • sha3-512

  • hmac-md5
  • hmac-sha1
  • hmac-sha224
  • hmac-sha256
  • hmac-sha512
  • hmac-sha384
  • hmac-ripemd160
  • hmac-sha3-224
  • hmac-sha3-256
  • hmac-sha3-384
  • hmac-sha3-512

  • rc4

  • bcrypt

  • hex
  • base64

AES Encryption/Decryption with secret key, iv and padding(ZERO / ANSI X.923/ ISO/IEC 9797-1 / ISO 10126 / PKCS5 / PKCS7).

  • aes-cbc
  • aes-cfb
  • aes-ctr
  • aes-ecb
  • aes-ofb
  • aes-gcm

DES Encryption/Decryption with secret key, iv and padding(ZERO / ANSI X.923/ ISO/IEC 9797-1 / ISO 10126 / PKCS5 / PKCS7).

  • des-cbc
  • des-cfb
  • des-ctr
  • des-ecb
  • des-ofb

3DES Encryption/Decryption with secret key, iv and padding(ZERO / ANSI X.923/ ISO/IEC 9797-1 / ISO 10126 / PKCS5 / PKCS7).

  • 3des-cbc
  • 3des-cfb
  • 3des-ctr
  • 3des-ecb
  • 3des-ofb

Twofish Encryption/Decryption with secret key, iv and padding(ZERO / ANSI X.923/ ISO/IEC 9797-1 / ISO 10126 / PKCS5 / PKCS7).

  • Twofish-cbc
  • Twofish-cfb
  • Twofish-ctr
  • Twofish-ecb
  • Twofish-ofb

Blowfish Encryption/Decryption with secret key, iv and padding(ZERO / ANSI X.923/ ISO/IEC 9797-1 / ISO 10126 / PKCS5 / PKCS7).

  • Blowfish-cbc
  • Blowfish-cfb
  • Blowfish-ctr
  • Blowfish-ecb
  • Blowfish-ofb

Staying up to date

To update crypto-go to the latest version, use go get -u github.com/trumanwong/cryptogo

License

This project is licensed under the terms of the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCBCDecrypt

func AesCBCDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesCBCDecrypt Aes CBC decryption with key, iv and padding

func AesCBCEncrypt

func AesCBCEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesCBCEncrypt Aes CBC encryption with key, iv and padding

func AesCFBDecrypt

func AesCFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesCFBDecrypt Aes CFB decryption with key, iv and padding

func AesCFBEncrypt

func AesCFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesCFBEncrypt Aes CFB encryption with key, iv and padding

func AesCTRDecrypt

func AesCTRDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesCTRDecrypt Aes CTR decryption with key, iv and padding

func AesCTREncrypt

func AesCTREncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesCTREncrypt Aes CTR encryption with key, iv and padding

func AesECBDecrypt

func AesECBDecrypt(src, key []byte, padding paddings.CipherPadding) ([]byte, error)

AesECBDecrypt Aes ECB decryption with key, iv and padding

func AesECBEncrypt

func AesECBEncrypt(clearText, key []byte, padding paddings.CipherPadding) ([]byte, error)

AesECBEncrypt Aes ECB encryption with key, iv and padding

func AesGCMDecrypt

func AesGCMDecrypt(src, key, nonce []byte) ([]byte, error)

func AesGCMEncrypt

func AesGCMEncrypt(clearText, key []byte) ([]byte, []byte, error)

AesGCMEncrypt Aes GCM encryption with key

func AesOFBDecrypt

func AesOFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesOFBDecrypt Aes OFB decryption with key, iv and padding

func AesOFBEncrypt

func AesOFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

AesOFBEncrypt Aes OFB encryption with key, iv and padding

func Base64Decode

func Base64Decode(src []byte) ([]byte, error)

Base64Decode base64 decode

func Base64Encode

func Base64Encode(src []byte) []byte

Base64Encode base64 encode

func BlowfishCBCDecrypt

func BlowfishCBCDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishCBCDecrypt Blowfish CBC decryption with key, iv and padding

func BlowfishCBCEncrypt

func BlowfishCBCEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishCBCEncrypt Blowfish CBC encryption with key, iv and padding

func BlowfishCFBDecrypt

func BlowfishCFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishCFBDecrypt Blowfish CFB decryption with key, iv and padding

func BlowfishCFBEncrypt

func BlowfishCFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishCFBEncrypt Blowfish CFB encryption with key, iv and padding

func BlowfishCTRDecrypt

func BlowfishCTRDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishCTRDecrypt Blowfish CTR decryption with key, iv and padding

func BlowfishCTREncrypt

func BlowfishCTREncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishCTREncrypt Blowfish CTR encryption with key, iv and padding

func BlowfishECBDecrypt

func BlowfishECBDecrypt(src, key []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishECBDecrypt Blowfish ECB decryption with key and padding

func BlowfishECBEncrypt

func BlowfishECBEncrypt(clearText, key []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishECBEncrypt Blowfish ECB encryption with key and padding

func BlowfishOFBDecrypt

func BlowfishOFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishOFBDecrypt Blowfish OFB decryption with key, iv and padding

func BlowfishOFBEncrypt

func BlowfishOFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

BlowfishOFBEncrypt Blowfish OFB encryption with key, iv and padding

func DesCBCDecrypt

func DesCBCDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesCBCDecrypt decrypts by des with cbc mode.

func DesCBCEncrypt

func DesCBCEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesCBCEncrypt encrypts by des with cbc mode.

func DesCFBDecrypt

func DesCFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesCFBDecrypt decrypts by des with cfb mode.

func DesCFBEncrypt

func DesCFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesCFBEncrypt encrypts by des with cfb mode.

func DesCTRDecrypt

func DesCTRDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesCTRDecrypt decrypts by des with ctr mode.

func DesCTREncrypt

func DesCTREncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesCTREncrypt encrypts by des with ctr mode.

func DesECBDecrypt

func DesECBDecrypt(src, key []byte, padding paddings.CipherPadding) ([]byte, error)

DesECBDecrypt decrypts by des with ecb mode.

func DesECBEncrypt

func DesECBEncrypt(clearText, key []byte, padding paddings.CipherPadding) ([]byte, error)

DesECBEncrypt encrypts by des with ecb mode.

func DesOFBDecrypt

func DesOFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesOFBDecrypt decrypts by des with ofb mode.

func DesOFBEncrypt

func DesOFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

DesOFBEncrypt encrypts by des with ofb mode.

func HexDecode

func HexDecode(src []byte) ([]byte, error)

HexDecode hex decode

func HexEncode

func HexEncode(src []byte) []byte

HexEncode hex encode

func HmacMD5

func HmacMD5(key, clearText string) string

HmacMD5 Keyed-hash message authentication codes (HMAC) is a mechanism for message authentication using cryptographic hash functions.

func HmacRIPEMD160

func HmacRIPEMD160(key, clearText string) string

HmacRIPEMD160 returns a hexadecimal encoding of ripemd160 encrypted string

func HmacSHA1

func HmacSHA1(key, clearText string) string

HmacSHA1 returns a hexadecimal encoding of sha1 encrypted string

func HmacSHA224

func HmacSHA224(key, clearText string) string

HmacSHA224 returns a hexadecimal encoding of sha-224 encrypted string

func HmacSHA256

func HmacSHA256(key, clearText string) string

HmacSHA256 returns a hexadecimal encoding of sha256 encrypted string

func HmacSHA3224

func HmacSHA3224(key, clearText string) string

HmacSHA3224 returns a hexadecimal encoding of sha3-224 encrypted string

func HmacSHA3256

func HmacSHA3256(key, clearText string) string

HmacSHA3256 returns a hexadecimal encoding of sha3-256 encrypted string

func HmacSHA3384

func HmacSHA3384(key, clearText string) string

HmacSHA3384 returns a hexadecimal encoding of sha3-384 encrypted string

func HmacSHA3512

func HmacSHA3512(key, clearText string) string

HmacSHA3512 returns a hexadecimal encoding of sha3-512 encrypted string

func HmacSHA384

func HmacSHA384(key, clearText string) string

HmacSHA384 returns a hexadecimal encoding of sha384 encrypted string

func HmacSHA512

func HmacSHA512(key, clearText string) string

HmacSHA512 returns a hexadecimal encoding of sha512 encrypted string

func MD5

func MD5(clearText string) string

MD5 return md5 encrypted string

func MD5Sixteen

func MD5Sixteen(clearText string) string

MD5Sixteen Returns a 16-bit MD5 encrypted string

func MD5SixteenToLower

func MD5SixteenToLower(clearText string) string

MD5SixteenToLower Returns a 16-digit uppercase MD5 encrypted string

func MD5SixteenToUpper

func MD5SixteenToUpper(clearText string) string

MD5SixteenToUpper Returns a 16-digit uppercase MD5 encrypted string

func MD5ToLower

func MD5ToLower(clearText string) string

MD5ToLower Return MD5 lowercase encrypted string

func MD5ToUpper

func MD5ToUpper(clearText string) string

MD5ToUpper Return MD5 uppercase encrypted string

func PasswordHash

func PasswordHash(clearText []byte, cost int) ([]byte, error)

PasswordHash returns the bcrypt hash of the password at the given cost. PasswordHash does not accept passwords longer than 72 bytes

func PasswordVerify

func PasswordVerify(clearText, hashedPassword []byte) bool

PasswordVerify compares a bcrypt hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.

func RC4Decrypt

func RC4Decrypt(key, password string) ([]byte, error)

func RC4Encrypt

func RC4Encrypt(key, clearText string) ([]byte, error)

RC4Encrypt RC4 encryption. key: RC4 key clearText: plaintext password

func RIPEMD160

func RIPEMD160(clearText string) string

RIPEMD160 return ripemd160 encrypted string

func SHA1

func SHA1(clearText string) string

SHA1 return sha1 encrypted string

func SHA224

func SHA224(clearText string) string

SHA224 SHA-224 is a variant of SHA-2 that produces a 224-bit digest.

func SHA256

func SHA256(clearText string) string

SHA256 return sha256 encrypted string

func SHA3224

func SHA3224(clearText string) string

SHA3224 SHA3-224 is a variant of SHA3 that produces a 224-bit digest.

func SHA3256

func SHA3256(clearText string) string

SHA3256 SHA3-256 is a variant of SHA3 that produces a 256-bit digest.

func SHA3384

func SHA3384(clearText string) string

SHA3384 SHA3-384 is a variant of SHA3 that produces a 384-bit digest.

func SHA3512

func SHA3512(clearText string) string

SHA3512 SHA3-512 is a variant of SHA3 that produces a 512-bit digest.

func SHA384

func SHA384(clearText string) string

SHA384 return sha384 encrypted string

func SHA512

func SHA512(clearText string) string

SHA512 return sha512 encrypted string

func TripleDesCBCDecrypt

func TripleDesCBCDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesCBCDecrypt decrypts by 3des with cbc mode.

func TripleDesCBCEncrypt

func TripleDesCBCEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesCBCEncrypt encrypts by 3des with cbc mode.

func TripleDesCFBDecrypt

func TripleDesCFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesCFBDecrypt decrypts by 3des with cfb mode.

func TripleDesCFBEncrypt

func TripleDesCFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesCFBEncrypt encrypts by 3des with cfb mode.

func TripleDesCTRDecrypt

func TripleDesCTRDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesCTRDecrypt decrypts by 3des with ctr mode.

func TripleDesCTREncrypt

func TripleDesCTREncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesCTREncrypt encrypts by 3des with ctr mode.

func TripleDesECBDecrypt

func TripleDesECBDecrypt(src, key []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesECBDecrypt decrypts by 3des with ecb mode.

func TripleDesECBEncrypt

func TripleDesECBEncrypt(clearText, key []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesECBEncrypt encrypts by 3des with ecb mode.

func TripleDesOFBDecrypt

func TripleDesOFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesOFBDecrypt decrypts by 3des with ofb mode.

func TripleDesOFBEncrypt

func TripleDesOFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TripleDesOFBEncrypt encrypts by 3des with ofb mode.

func TwofishCBCDecrypt

func TwofishCBCDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishCBCDecrypt Twofish CBC decryption with key, iv and padding

func TwofishCBCEncrypt

func TwofishCBCEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishCBCEncrypt Twofish CBC encryption with key, iv and padding

func TwofishCFBDecrypt

func TwofishCFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishCFBDecrypt Twofish CFB decryption with key, iv and padding

func TwofishCFBEncrypt

func TwofishCFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishCFBEncrypt Twofish CFB encryption with key, iv and padding

func TwofishCTRDecrypt

func TwofishCTRDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishCTRDecrypt Twofish CTR decryption with key, iv and padding

func TwofishCTREncrypt

func TwofishCTREncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishCTREncrypt Twofish CTR encryption with key, iv and padding

func TwofishECBDecrypt

func TwofishECBDecrypt(src, key []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishECBDecrypt Twofish ECB decryption with key and padding

func TwofishECBEncrypt

func TwofishECBEncrypt(clearText, key []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishECBEncrypt Twofish ECB encryption with key and padding

func TwofishOFBDecrypt

func TwofishOFBDecrypt(src, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishOFBDecrypt Twofish OFB decryption with key, iv and padding

func TwofishOFBEncrypt

func TwofishOFBEncrypt(clearText, key, iv []byte, padding paddings.CipherPadding) ([]byte, error)

TwofishOFBEncrypt Twofish OFB encryption with key, iv and padding

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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