gm
github.com/mfpierre/go-mcrypt
go get github.com/mfpierre/go-mcrypt
gm

github.com/mfpierre/go-mcrypt

Go bindings for mcrypt library

by Pierre Margueritte

v0.0.0-20170529160712-80616da4b26f (see all)License:MIT
go get github.com/mfpierre/go-mcrypt
Readme

go-mcrypt

Build Status

Go bindings for mcrypt library.

Should be compatible with most algo/modes supported by libmcrypt.

Requirements

Usage

package main

import (
    "fmt"
    mcrypt "github.com/mfpierre/go-mcrypt"
)

func main() {
    key := []byte("here is a random key of 32 bytes")
    plaintext := []byte("here is what you want to encrypt")
    iv := make([]byte, 16)

    // using CAST-256 in ECB mode
    encrypted, _ := mcrypt.Encrypt(key, iv, plaintext, "cast-256", "ecb")
    decrypted, _ := mcrypt.Decrypt(key, iv, encrypted, "cast-256", "ecb")
    fmt.Println(encrypted)
    fmt.Println(decrypted)
}

Below a reminder of IV & Key size that you can use depending on algo/mode settings

Cipher NameBlock ModeBlock SizeIV SizeDefault Key SizeAll Key Size(s)
CAST-128CBC881616
CAST-128ECB881616
CAST-128OFB881616
CAST-128NOFB881616
CAST-128CFB881616
CAST-128NCFB881616
CAST-128CTR881616
GOSTCBC883232
GOSTECB883232
GOSTOFB883232
GOSTNOFB883232
GOSTCFB883232
GOSTNCFB883232
GOSTCTR883232
Rijndael-128CBC16163216 24 32
Rijndael-128ECB16163216 24 32
Rijndael-128OFB16163216 24 32
Rijndael-128NOFB16163216 24 32
Rijndael-128CFB16163216 24 32
Rijndael-128NCFB16163216 24 32
Rijndael-128CTR16163216 24 32
TwofishCBC16163216 24 32
TwofishECB16163216 24 32
TwofishOFB16163216 24 32
TwofishNOFB16163216 24 32
TwofishCFB16163216 24 32
TwofishNCFB16163216 24 32
TwofishCTR16163216 24 32
RC4STREAM10256
CAST-256CBC16163216 24 32
CAST-256ECB16163216 24 32
CAST-256OFB16163216 24 32
CAST-256NOFB16163216 24 32
CAST-256CFB16163216 24 32
CAST-256NCFB16163216 24 32
CAST-256CTR16163216 24 32
LOKI97CBC16163216 24 32
LOKI97ECB16163216 24 32
LOKI97OFB16163216 24 32
LOKI97NOFB16163216 24 32
LOKI97CFB16163216 24 32
LOKI97NCFB16163216 24 32
LOKI97CTR16163216 24 32
Rijndael-192CBC24243216 24 32
Rijndael-192ECB24243216 24 32
Rijndael-192OFB24243216 24 32
Rijndael-192NOFB24243216 24 32
Rijndael-192CFB24243216 24 32
Rijndael-192NCFB24243216 24 32
Rijndael-192CTR24243216 24 32
Safer+CBC16163216 24 32
Safer+ECB16163216 24 32
Safer+OFB16163216 24 32
Safer+NOFB16163216 24 32
Safer+CFB16163216 24 32
Safer+NCFB16163216 24 32
Safer+CTR16163216 24 32
WAKESTREAM103232
BlowfishCBC8856
BlowfishECB8856
BlowfishOFB8856
BlowfishNOFB8856
BlowfishCFB8856
BlowfishNCFB8856
BlowfishCTR8856
DESCBC8888
DESECB8888
DESOFB8888
DESNOFB8888
DESCFB8888
DESNCFB8888
DESCTR8888
Rijndael-256CBC32323216 24 32
Rijndael-256ECB32323216 24 32
Rijndael-256OFB32323216 24 32
Rijndael-256NOFB32323216 24 32
Rijndael-256CFB32323216 24 32
Rijndael-256NCFB32323216 24 32
Rijndael-256CTR32323216 24 32
SerpentCBC16163216 24 32
SerpentECB16163216 24 32
SerpentOFB16163216 24 32
SerpentNOFB16163216 24 32
SerpentCFB16163216 24 32
SerpentNCFB16163216 24 32
SerpentCTR16163216 24 32
xTEACBC881616
xTEAECB881616
xTEAOFB881616
xTEANOFB881616
xTEACFB881616
xTEANCFB881616
xTEACTR881616
BlowfishCBC8856
BlowfishECB8856
BlowfishOFB8856
BlowfishNOFB8856
BlowfishCFB8856
BlowfishNCFB8856
BlowfishCTR8856
enigmaSTREAM1013
RC2CBC88128
RC2ECB88128
RC2OFB88128
RC2NOFB88128
RC2CFB88128
RC2NCFB88128
RC2CTR88128
3DESCBC882424
3DESECB882424
3DESOFB882424
3DESNOFB882424
3DESCFB882424
3DESNCFB882424
3DESCTR882424

Credits

Thanks to https://github.com/tblyler/go-mcrypt for initial implementation with rijndael

GitHub Stars

12

LAST COMMIT

5yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
v0.0.0-20170529160712-80616da4b26f
3yrs ago
No alternatives found
No tutorials found
Add a tutorial