Giter Club home page Giter Club logo

passwd-crypto's Introduction

passwordcrypto

This Python module provides a simple password manager for securely storing and retrieving encrypted password entries. The passwords are encrypted using the Fernet symmetric encryption scheme. The module includes functionality to derive a Fernet key from a password, initialize a password manager instance, retrieve encrypted passwords, decrypt and read stored passwords, encrypt text, and write new password entries to a file.

Usage

Initialization

from passwordcrypto import Passwd, generate_key_from_password

# Example usage
password = b'MyStrongPassword'
key = generate_key_from_password(password)
filename = 'passwords.txt'

# Initialize a Passwd instance
password_manager = Passwd(filename, key)

Reading Passwords

# Retrieve encrypted passwords from the file
encrypted_passwords = password_manager.getEncryptedPasswds()

# Decrypt and read stored passwords
password_entries = password_manager.read()

Writing Passwords

# Write a new password entry to the file
app_name = 'MyApp'
email_address = '[email protected]'
user_password = 'SecurePassword123'

password_manager.write(app_name, email_address, user_password)

API Reference

generate_key_from_password(password: bytes) -> Fernet

Generates a Fernet key derived from the provided password.

class Passwd(filename: str, key: bytes) -> None

Initialize a Passwd instance.

  • filename (str): The name of the file to store encrypted passwords.
  • key (bytes): The Fernet key used for encryption and decryption.

getEncryptedPasswds() -> list[bytes]

Retrieve encrypted passwords from the file.

read() -> list[list[str]]

Decrypt and read stored passwords from the file. Returns a list of decrypted password entries, where each entry is a list with the format [App, Email, Password].

encrypt(text: str) -> bytes

Encrypt the given text using the Fernet key.

  • text (str): The text to be encrypted.

write(app: str, email: str, password: str) -> None

Encrypt and write a new password entry to the file.

  • app (str): The application or service name.
  • email (str): The associated email address.
  • password (str): The password for the application or service.

Security Note

Adjust the number of iterations in the key derivation process (iterations parameter in generate_key_from_password) based on your security requirements. Higher iterations increase security but also result in longer key derivation times.

passwd-crypto's People

Contributors

muxutruk2 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.