pysodium | wrapper for libsodium providing high level crypto primitives | Cryptography library
kandi X-RAY | pysodium Summary
kandi X-RAY | pysodium Summary
This is a very simple wrapper around libsodium masquerading as nacl.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encrypts a message using the Blake2B private key
- Pad a buffer
- Read the cipherstream from the secret stream
- XOR of a message using the XOR algorithm
- Push a message to the secret stream
- Create a crypto sign state
- This function is used to get client session keys
- Get the key pair for a key pair
- Encrypts a message using the IETF - Chacha20poly1305
- XOR algorithm for xchacha20
- Decrypt the decacha20poly1305 Poly1305 polygon
- Calculate a cryptographic key using a cryptographic key
- Calculate the chacha20 - encoded message
- Encrypts a message using the standard key
- Decrypt decacha20poly1305 polygon
- Encrypts a message using the specified key
- Encrypts a message using the private key
- Calculate the SHA256 hash of a cryptographic key
- Encrypts the contents of the given message
- Decrypts the xchacha20poly1305 poly1305 polygon
- XOR of a message using the chacha20 algorithm
pysodium Key Features
pysodium Examples and Code Snippets
import cryptography.fernet
import argon2
import base64
def encrypt_data(data_bytes, password, salt):
password_hash = argon2.argon2_hash(password=password, salt=salt)
encoded_hash = base64.urlsafe_b64encode(password_hash[:32])
Community Discussions
Trending Discussions on pysodium
QUESTION
I have some data in a python program that I'd like to encrypt before writing to a file with a password, and then read it and decrypt it before using it. I'm looking for some secure symmetric algorithm that can encrypt and decrypt against a password.
This question shows a non-secure way and suggests using libsodium. Since I'm using Python, I found pysodium. It seems to have tons of functions mapped from libsodium, but I don't know how to simply encrypt/decrypt data against password.
My problem is that it looks like all encryption algorithms use keys. I don't want to use keys. I want to only use a password. Just like what I do in the terminal:
To encrypt:
...ANSWER
Answered 2018-Mar-24 at 19:28So my question reduced to: "How can I encrypt data against a password in Python". I gave up on pysodium due to the lack of documentation. I used cryptography
and argon2
packages to write my own encryption algorithm (it's not my own crypto algorithm, I know Rule No. 1 in crypto; it's just the procedure to utilize what's already there). So here are my functions:
QUESTION
I've created a script on windows to connect to Remote SSH server. I have successfully installed cryptography
, pynacl
and finally paramiko
(Took me an entire day to figure out how to successfully install them on windows).
Now that I run the script, it pops an error saying that the DLL loading has failed. The error seems to be related to libsodium
but I cannot figure out exactly which DLL is to trying to load and from where. Just to be on the safer side I also installed pysodium
.
Here's the script:
...automate.py
ANSWER
Answered 2017-Nov-22 at 05:15After a lot of googling, I finally stumbled upon this. As mentioned in the conversation I uninstalled my previous pynacl installation, downloaded the zipped source from https://github.com/lmctv/pynacl/archive/v1.2.a0.reorder.zip, downloaded libsodium from https://github.com/jedisct1/libsodium/releases/download/1.0.15/libsodium-1.0.15.tar.gz, set LIB
environment variable to D:\Users\prashant-gu\Downloads\libsodium-1.0.15\bin\x64\Release\v140\dynamic
, and finally installed pynacl form this downloaded source using
pip install .
Now it works fine.
During the installation of paramiko
, I also happen to download OpenSSL from https://ci.cryptography.io/job/cryptography-support-jobs/job/openssl-release-1.1/, and set INCLUDE environment variable to D:\Users\prashant-gu\Downloads\openssl-1.1.0g-2015-x86_64\openssl-win64-2015\include
in order to successfully install the cryptography
package which happens to be a dependency for paramiko
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pysodium
You can use pysodium like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page