Socket
Socket
Sign inDemoInstall

github.com/jamesruan/sodium

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/jamesruan/sodium

Package sodium is a wrapper for https://github.com/jedisct1/libsodium Most of the functions is a method to the "Bytes" type. They are grouped below: Sender sign a message with its SecretKey and the receiver can verify the Signature by sender's PublicKey (Ed25519) (Ed25519ph) An anonymous can encrypt a message with an ephemeral key pair and reveiver's PublicKey. The receiver can decrypt the message with its SecretKey. Only the receiver is authenticated. (X25519-XSalsa20-Poly1305) Authenticated Box can be used to pass encrypt message from a known sender to a known receiver. The sender and the receiver are both authenticated to each other. A one-time shared nonce is also generated and passed to protect the key pairs and messages. (X25519-XSalsa20-Poly1305) Server and Client exchange their public key and calculates a common session key with their own secret key. (rx || tx = BLAKE2B-512(p.n || client_pk || server_pk)) One holder of a secret key authenticates the message with MAC. (HMAC-SHA512256) Use a secret key and a nonce to protect the key, messages could be encrypted into a SecretBox. The encrypted data's intergrity is checked when decryption. (XSalsa20-Poly1305) Use a secret key and a nonce to protect the key, messages could be encrypted. Optional additional data and the message is authenticited with an authentication tag. Both intergrity and authenticity is checked when decryption. The decryption would not be performed unless the authentication tag is verified. AEADCP* (ChaCha20-Poly1305_IETF) AEADXCP* (XChaCha20-Poly1305_IETF) High-level streaming API that use AEAD construct. Using `SecretStreamTag_Sync` to indicate the end of message. And this is useful for application to parse the message earlier. Rekeying is automatic. However using `SecretStreamTag_Rekey` explicitly ask for rekeying. Typical usage is sending chunks with `SecretStreamTag_Message`. XCP (XChaCha20-Poly1305_IETF) Deriving subkeys from a single high-entropy key KDF (BLAKE2B)


Version published

Readme

Source

sodium

A wrapper for libsodium in golang

See documents GoDoc.

Currently this is build against libsodium 1.0.18.

Following functions included:

  • crypto_auth crypto_auth_verify
  • crypto_sign_keypair crypto_sign_seed_keypair crypto_sign_ed25519_sk_to_seed crypto_sign_ed25519_sk_to_pk
  • crypto_sign crypto_sign_open crypto_sign_detached crypto_sign_verify_detached
  • crypto_sign_init crypto_sign_update crypto_sign_final_create crypto_sign_final_verify
  • crypto_sign_ed25519_sk_to_curve25519 crypto_sign_ed25519_pk_to_curve25519
  • crypto_scalarmult_base crypto_scalarmult
  • crypto_box_keypair crypto_box_seed_keypair
  • crypto_box_seal crypto_box_seal_open
  • crypto_box_easy crypto_box_open_easy crypto_box_detached crypto_box_open_detached
  • crypto_secretbox_easy crypto_secretbox_open_easy crypto_secretbox_detached crypto_secretbox_open_detached
  • crypto_pwhash crypto_pwhash_str crypto_pwhash_str_verify
  • crypto_pwhash_opslimit_interactive crypto_pwhash_memlimit_interactive
  • crypto_pwhash_opslimit_moderate crypto_pwhash_memlimit_moderate
  • crypto_pwhash_opslimit_sensitive crypto_pwhash_memlimit_sensitive
  • crypto_shorthash crypto_generichash_init crypto_generichash_update crypto_generichash_final
  • crypto_kdf_keygen crypto_kdf_derive_from_key
  • crypto_kx_keypair crypto_kx_seed_keypair crypto_kx_server_session_keys crypto_kx_client_session_keys
  • crypto_aead_chacha20poly1305_ietf_keygen crypto_aead_chacha20poly1305_ietf_encrypt crypto_aead_chacha20poly1305_ietf_decrypt
  • crypto_aead_chacha20poly1305_ietf_encrypt_detached crypto_aead_chacha20poly1305_ietf_decrypt_detached
  • crypto_aead_xchacha20poly1305_ietf_keygen crypto_aead_xchacha20poly1305_ietf_encrypt crypto_aead_xchacha20poly1305_ietf_decrypt
  • crypto_aead_xchacha20poly1305_ietf_encrypt_detached crypto_aead_xchacha20poly1305_ietf_decrypt_detached
  • crypto_secretstream_xchacha20poly1305_keygen crypto_secretstream_xchacha20poly1305_push_init crypto_secretstream_xchacha20poly1305_push
  • crypto_secretstream_xchacha20poly1305_pull_init crypto_secretstream_xchacha20poly1305_pull
  • sodium_memzero sodium_memcmp sodium_increment

NOTE: This is a modified and enhanced version based on github.com/GoKillers/libsodium-go. Because there're a lot of package reformat and interface changes, I'd like to launch a new project. Thankfully, the original author permits reuse its code as long as the original LICENSE remains. You can find the LICENSE.original and README.original.md stating the original license. And this version is released under MIT License.

FAQs

Last updated on 02 Jan 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc