INNER CODE UNIT · Go

Decrypt

cryptag/cryptag · encrypt_decrypt.go:39

func Decrypt(cipher []byte, nonce *[24]byte, key *[32]byte) ([]byte, error) {
	if nonce == nil {
		return nil, ErrNilNonce
	}
	if key == nil {
		return nil, ErrNilKey
	}
	if len(cipher) == 0 {
		return nil, ErrDecryptEmpty
	}

	plain, ok := secretbox.Open(nil, cipher, nonce, key)
	if !ok {
		return nil, ErrDecrypt
	}
	return plain, nil
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…