Showing posts with the label Python

Python RSA Encryption And Decryption Example

The cryptographic technique known as Rivest-Shamir-Adleman, or RSA, is used for certain security services or goals. It allows for public-key encryption and is frequently used to protect sensitive data, especially when it's being transferred over an unreliable network like the HTTP. Whereas a private key is confidential and needs to be kept to yourself, a public key is shared with others.   The following illustration highlights how asymmetric cryptography works:   Example:  RSA Encryption and Decryption with RSA-OAEP Padding from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP import base64   # 2048 is the number of bits for RSA keys = RSA.generate( 2048 ) publicKey = keys.publickey() publicKeyPEM = publicKey.exportKey() print( "\n" ,publicKeyPEM.decode( 'ascii' )) privateKeyPEM = keys.exportKey() print( "\n" ,privateKeyPEM.decode( 'ascii' )) # Your secret text secretMessage = 'This is your secret' #encrypt the messag

Python - MD5 , SHA-1, SHA-256, & SHA-512 Hashing

Hashing is the transformation of any given key or string of characters into a new value. The new value is typically a short, fixed-length key that represents the original string and makes it simpler to find or use. Please note that once this hash is created and saved to the database, it cannot be changed back to your original password. MD5 hash in Python MD5 (Message-Digest algorithm) is one of the most popular hash functions. It produces a hash value of 128 bits. Originally, MD5 was designed to be a cryptographic hash function. However, it has a large number of known vulnerabilities. MD5 can still be used for checksums to check the integrity of data, but only against accidental corruption. It is still suitable for non-cryptographic uses, such as determining the partition of a specific key in a distributed database. Example:  Use hashlib.md5() method to generate an MD5 hash value from a String.   # Python3 code to demonstrate the MD5 import hashlib   # initializing the string str = &q

Vue.js + Python + MongoDB CRUD example

Hello everyone, today we will learn how to develop a  web application that is a basic User Management Application using MongoDB , Vue.js , Python , and Flask . GitHub repository link is provided at the end of this tutorial. You can download the source code. More Related Topics, React.js + Python + MongoDB CRUD application Python + MongoDB + Vue.js CRUD Application  Angular10 + Python + MongoDB CRUD application Python-Create a CRUD Restful Service API using FLASK and MYSQL Python-Simple CRUD Web App with Python, Flask, and Mysql Python with MongoDB Atlas - CRUD After completing this tutorial what we will build? We will build a full-stack web application that is a basic User Management Application with CRUD features:       • Create User     • List User     • Update User     • Delete User User Interfaces -Retrieve all Users: -Add a User: -Update User: We divided this tutorial into two parts.  PART 1 - Rest APIs Development using Python and Flask PART 2 - UI development using Vue.js PART 1