Versions in this module Expand all Collapse all v1 v1.5.2 May 22, 2023 Changes in this version + const SecretStreamTag_Final + const SecretStreamTag_Message + const SecretStreamTag_Push + const SecretStreamTag_Rekey + const SecretStreamTag_Sync + var CryptoKDFBytesMax = int(C.crypto_kdf_bytes_max()) + var CryptoKDFBytesMin = int(C.crypto_kdf_bytes_min()) + var CryptoKDFContextBytes = int(C.crypto_kdf_contextbytes()) + var CryptoPWHashMemLimitInteractive = int(C.crypto_pwhash_memlimit_interactive()) + var CryptoPWHashMemLimitModerate = int(C.crypto_pwhash_memlimit_moderate()) + var CryptoPWHashMemLimitSensitive = int(C.crypto_pwhash_memlimit_sensitive()) + var CryptoPWHashOpsLimitInteractive = int(C.crypto_pwhash_opslimit_interactive()) + var CryptoPWHashOpsLimitModerate = int(C.crypto_pwhash_opslimit_moderate()) + var CryptoPWHashOpsLimitSensitive = int(C.crypto_pwhash_opslimit_sensitive()) + var ErrAuth = errors.New("sodium: Message forged") + var ErrDecryptAEAD = errors.New("sodium: Can't decrypt message") + var ErrDecryptSS = errors.New("sodium: Can't decrypt stream") + var ErrInvalidHeader = errors.New("sodium: Invalid header") + var ErrInvalidKey = errors.New("sodium: Invalid key") + var ErrInvalidState = errors.New("sodium: Invalid state") + var ErrOpenBox = errors.New("sodium: Can't open box") + var ErrOpenSign = errors.New("sodium: Signature forged") + var ErrPassword = errors.New("sodium: Password not matched") + var ErrUnknown = errors.New("sodium: Unknown") + var RuntimeHasNeon = bool(C.sodium_runtime_has_neon() != 0) + var RuntimeHasSse2 = bool(C.sodium_runtime_has_sse2() != 0) + var RuntimeHasSse3 = bool(C.sodium_runtime_has_sse3() != 0) + func MemCmp(buff1, buff2 Bytes, length int) int + func MemZero(buff1 Bytes) + func NewGenericHash(outlen int) hash.Hash + func NewGenericHashDefault() hash.Hash + func NewGenericHashDefaultKeyed(key GenericHashKey) hash.Hash + func NewGenericHashKeyed(outlen int, key GenericHashKey) hash.Hash + func Randomize(k Typed) + type AEADCPKey struct + func MakeAEADCPKey() AEADCPKey + func (AEADCPKey) Size() int + type AEADCPMAC struct + func (AEADCPMAC) Size() int + type AEADCPNonce struct + func (AEADCPNonce) Size() int + func (n *AEADCPNonce) Next() + type AEADXCPKey struct + func MakeAEADXCPKey() AEADXCPKey + func (AEADXCPKey) Size() int + type AEADXCPMAC struct + func (AEADXCPMAC) Size() int + type AEADXCPNonce struct + func (AEADXCPNonce) Size() int + func (n *AEADXCPNonce) Next() + type BoxKP struct + PublicKey BoxPublicKey + SecretKey BoxSecretKey + func MakeBoxKP() BoxKP + func SeedBoxKP(seed BoxSeed) BoxKP + type BoxMAC struct + func (b BoxMAC) Size() int + type BoxNonce struct + func (b *BoxNonce) Next() + func (n BoxNonce) Size() int + type BoxPublicKey struct + func (k BoxPublicKey) Size() int + type BoxSecretKey struct + func (k BoxSecretKey) PublicKey() BoxPublicKey + func (k BoxSecretKey) Size() int + type BoxSeed struct + func (b BoxSeed) Size() int + type Bytes []byte + func (b Bytes) AEADCPDecrypt(ad Bytes, n AEADCPNonce, k AEADCPKey) (m Bytes, err error) + func (b Bytes) AEADCPDecryptDetached(mac AEADCPMAC, ad Bytes, n AEADCPNonce, k AEADCPKey) (m Bytes, err error) + func (b Bytes) AEADCPEncrypt(ad Bytes, n AEADCPNonce, k AEADCPKey) (c Bytes) + func (b Bytes) AEADCPEncryptDetached(ad Bytes, n AEADCPNonce, k AEADCPKey) (c Bytes, mac AEADCPMAC) + func (b Bytes) AEADCPVerify(ad Bytes, n AEADCPNonce, k AEADCPKey) (err error) + func (b Bytes) AEADCPVerifyDetached(mac AEADCPMAC, ad Bytes, n AEADCPNonce, k AEADCPKey) (err error) + func (b Bytes) AEADXCPDecrypt(ad Bytes, n AEADXCPNonce, k AEADXCPKey) (m Bytes, err error) + func (b Bytes) AEADXCPDecryptDetached(mac AEADXCPMAC, ad Bytes, n AEADXCPNonce, k AEADXCPKey) (m Bytes, err error) + func (b Bytes) AEADXCPEncrypt(ad Bytes, n AEADXCPNonce, k AEADXCPKey) (c Bytes) + func (b Bytes) AEADXCPEncryptDetached(ad Bytes, n AEADXCPNonce, k AEADXCPKey) (c Bytes, mac AEADXCPMAC) + func (b Bytes) AEADXCPVerify(ad Bytes, n AEADXCPNonce, k AEADXCPKey) (err error) + func (b Bytes) AEADXCPVerifyDetached(mac AEADXCPMAC, ad Bytes, n AEADXCPNonce, k AEADXCPKey) (err error) + func (b Bytes) Auth(key MACKey) (mac MAC) + func (b Bytes) AuthVerify(mac MAC, key MACKey) (err error) + func (b Bytes) Box(n BoxNonce, pk BoxPublicKey, sk BoxSecretKey) (c Bytes) + func (b Bytes) BoxDetached(n BoxNonce, pk BoxPublicKey, sk BoxSecretKey) (mac BoxMAC, c Bytes) + func (b Bytes) BoxOpen(n BoxNonce, pk BoxPublicKey, sk BoxSecretKey) (m Bytes, err error) + func (b Bytes) BoxOpenDetached(mac BoxMAC, n BoxNonce, pk BoxPublicKey, sk BoxSecretKey) (m Bytes, err error) + func (b Bytes) Length() int + func (b Bytes) SealedBox(pk BoxPublicKey) (cm Bytes) + func (b Bytes) SealedBoxOpen(kp BoxKP) (m Bytes, err error) + func (b Bytes) SecretBox(n SecretBoxNonce, k SecretBoxKey) (c Bytes) + func (b Bytes) SecretBoxDetached(n SecretBoxNonce, k SecretBoxKey) (c Bytes, mac SecretBoxMAC) + func (b Bytes) SecretBoxOpen(n SecretBoxNonce, k SecretBoxKey) (m Bytes, err error) + func (b Bytes) SecretBoxOpenDetached(mac SecretBoxMAC, n SecretBoxNonce, k SecretBoxKey) (m Bytes, err error) + func (b Bytes) Shorthash(key ShortHashKey) (out Bytes) + func (b Bytes) Sign(key SignSecretKey) (sm Bytes) + func (b Bytes) SignDetached(key SignSecretKey) (sig Signature) + func (b Bytes) SignOpen(key SignPublicKey) (m Bytes, err error) + func (b Bytes) SignVerifyDetached(sig Signature, key SignPublicKey) (err error) + type GenericHash struct + func (g *GenericHash) Reset() + func (g *GenericHash) Sum(b []byte) []byte + func (g *GenericHash) Write(p []byte) (n int, err error) + func (g GenericHash) BlockSize() int + func (g GenericHash) Size() int + type GenericHashKey struct + func (GenericHashKey) Size() int + type KXKP struct + PublicKey KXPublicKey + SecretKey KXSecretKey + func MakeKXKP() KXKP + func SeedKXKP(seed KXSeed) KXKP + func (kp KXKP) ClientSessionKeys(server_pk KXPublicKey) (*KXSessionKeys, error) + func (kp KXKP) ServerSessionKeys(client_pk KXPublicKey) (*KXSessionKeys, error) + type KXPublicKey struct + func (k KXPublicKey) Size() int + type KXSecretKey struct + func (k KXSecretKey) Size() int + type KXSeed struct + func (k KXSeed) Size() int + type KXSessionKey struct + func (k KXSessionKey) Size() int + type KXSessionKeys struct + Rx KXSessionKey + Tx KXSessionKey + type KeyContext string + func MakeKeyContext(s string) KeyContext + func (KeyContext) Size() int + func (k KeyContext) Length() int + type MAC struct + func (b MAC) Size() int + type MACKey struct + func (b MACKey) Size() int + type MasterKey struct + func MakeMasterKey() MasterKey + func (MasterKey) Size() int + func (m MasterKey) Derive(length int, id uint64, context KeyContext) SubKey + func (m MasterKey) Length() int + type Nonce interface + Next func() + type PWHashSalt struct + func (s PWHashSalt) Size() int + type PWHashStr struct + func LoadPWHashStr(b Bytes) PWHashStr + func PWHashStore(pw string) PWHashStr + func PWHashStoreInteractive(pw string) PWHashStr + func PWHashStoreSensitive(pw string) PWHashStr + func (s PWHashStr) Length() int + func (s PWHashStr) PWHashVerify(pw string) (err error) + func (s PWHashStr) Size() int + func (s PWHashStr) Value() Bytes + type Scalar struct + func CryptoScalarmultBase(n Scalar) (q Scalar) + func (s Scalar) Size() int + type ScalarMult struct + func CryptoScalarmult(n, p Scalar) (q ScalarMult) + func (s ScalarMult) Size() int + type SecretBoxKey struct + func (s SecretBoxKey) Size() int + type SecretBoxMAC struct + func (s SecretBoxMAC) Size() int + type SecretBoxNonce struct + func (n *SecretBoxNonce) Next() + func (n SecretBoxNonce) Size() int + type SecretStreamDecoder interface + SetAdditionData func(ad []byte) + Tag func() SecretStreamTag + func MakeSecretStreamXCPDecoder(key SecretStreamXCPKey, in io.Reader, header SecretStreamXCPHeader) (SecretStreamDecoder, error) + type SecretStreamEncoder interface + Header func() SecretStreamXCPHeader + SetAdditionData func(ad []byte) + SetTag func(SecretStreamTag) + WriteAndClose func(b []byte) (n int, err error) + func MakeSecretStreamXCPEncoder(key SecretStreamXCPKey, out io.Writer) SecretStreamEncoder + type SecretStreamTag uint8 + type SecretStreamXCPDecoder struct + func (e *SecretStreamXCPDecoder) Read(b []byte) (n int, err error) + func (e *SecretStreamXCPDecoder) SetAdditionData(ad []byte) + func (e SecretStreamXCPDecoder) Tag() SecretStreamTag + type SecretStreamXCPEncoder struct + func (e *SecretStreamXCPEncoder) Close() error + func (e *SecretStreamXCPEncoder) SetAdditionData(ad []byte) + func (e *SecretStreamXCPEncoder) SetTag(t SecretStreamTag) + func (e *SecretStreamXCPEncoder) Write(b []byte) (n int, err error) + func (e *SecretStreamXCPEncoder) WriteAndClose(b []byte) (n int, err error) + func (e SecretStreamXCPEncoder) Header() SecretStreamXCPHeader + type SecretStreamXCPHeader struct + func (SecretStreamXCPHeader) Size() int + type SecretStreamXCPKey struct + func MakeSecretStreamXCPKey() SecretStreamXCPKey + func (SecretStreamXCPKey) Size() int + type ShortHash struct + func (s ShortHash) Size() int + type ShortHashKey struct + func (s ShortHashKey) Size() int + type SignKP struct + PublicKey SignPublicKey + SecretKey SignSecretKey + func MakeSignKP() SignKP + func SeedSignKP(seed SignSeed) SignKP + func (p SignKP) ToBox() BoxKP + type SignPublicKey struct + func (k SignPublicKey) Size() int + func (k SignPublicKey) ToBox() BoxPublicKey + type SignSecretKey struct + func (k SignSecretKey) PublicKey() SignPublicKey + func (k SignSecretKey) Seed() SignSeed + func (k SignSecretKey) Size() int + func (k SignSecretKey) ToBox() BoxSecretKey + type SignSeed struct + func (k SignSeed) Size() int + type SignState struct + func NewSignState() *SignState + func (s *SignState) Sign(key SignSecretKey) Signature + func (s *SignState) Update(b []byte) + func (s *SignState) Verify(sig Signature, key SignPublicKey) (err error) + type Signature struct + func (b Signature) Size() int + type SubKey struct + func (SubKey) Size() int + type Typed interface + Length func() int + Size func() int