Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const BlockSize = 32
Variables ¶
View Source
var ErrInvalidKeySize = errors.New("key size must be 16, 24 or 32 bytes")
Functions ¶
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
func (*Cipher) Decrypt ¶
Example ¶
package main import ( "bytes" "fmt" "github.com/elvishp2006/go-mcrypt/pkg/rijndael256" ) func main() { r, err := rijndael256.NewCipher([]byte("1234567890123456")) if err != nil { panic(err) } encrypted := make([]byte, 32) r.Encrypt(encrypted, []byte("123")) decrypted := make([]byte, 32) r.Decrypt(decrypted, encrypted) fmt.Println(string(bytes.Trim(decrypted, "\x00"))) }
Output: 123
func (*Cipher) Encrypt ¶
Example ¶
package main import ( "encoding/base64" "fmt" "github.com/elvishp2006/go-mcrypt/pkg/rijndael256" ) func main() { r, err := rijndael256.NewCipher([]byte("1234567890123456")) if err != nil { panic(err) } encrypted := make([]byte, 32) r.Encrypt(encrypted, []byte("123")) fmt.Println(base64.StdEncoding.EncodeToString(encrypted)) }
Output: Pd0dwZIwEvgxedRZNxBopvDWg1xbLrAwoh7RA/i1MW0=
Click to show internal directories.
Click to hide internal directories.