Cryptography, Hashing, Encoding-Decoding
3 min readMar 1, 2021
Cryptography
- Cryptography is a method of using advanced mathematical principles in storing and transmitting data in a particular form so that only those whom it is intended can read and process it.
- Cryptography is nothing but Encryption and Decryption.
- Two types: Symmetric and Asymmetric.
- In Symmetric, the Same key used for encryption, and decryption, much faster so used for large data.
- In Asymmetric, a public key is used for encryption while a private key for decryption. Comparatively, slow so used for user-sensitive information.
- AES, DES, Blowfish, RC4 are some algorithms used for symmetric cryptography.
- RSA, DSA, Elliptical curve, PKCS are some algorithms used for asymmetric cryptography.
- Symmetric encryption is an old technique while asymmetric encryption is relatively new.
- Asymmetric encryption was introduced to complement the inherent problem of the need to share the key in the symmetric encryption model, eliminating the need to share the key by using a pair of public-private keys.
- SSL/TLS uses both asymmetric and symmetric encryption.
Symmetric and Asymmetric can be divided into :
- Transposition Ciphers: In Cryptography, a transposition cipher is a method of encryption by which the positions held by units of plaintext (which are commonly characters or groups of characters) are shifted according to a regular system so that the ciphertext constitutes a permutation of the plaintext.
- Substitution Cipher: Method of encryption by which units of plaintext are replaced with ciphertext, according to a fixed system; the “units” may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth.
- Stream Cipher: Symmetric or secret-key encryption algorithm that encrypts a single bit at a time. With a Stream Cipher, the same plaintext bit or byte will encrypt to a different bit or byte every time it is encrypted.
- Block Cipher: An encryption method that applies a deterministic algorithm along with a symmetric key to encrypt a block of text, rather than encrypting one bit at a time as in-stream ciphers
Hashing
- Hashing is the transformation of a string of characters into a usually shorter fixed-length value that represents the original string.
- Hash functions are: MD5 ( Deprecated ), SHA -1, SHA -512, CRC32, Adler32, RipeMD128
- It is a one-way process, cannot generate original info from the hash
- Hash functions don’t need a key to generate hash values.
- Hash values are the same for the same inputs but a slight difference in the input will result in a different hash.
- Hash values are used to find integrity or uniqueness.
Encoding — Decoding
Encoding is the process of converting data into a format required for a number of information processing needs, including:
- Program compiling and execution
- Data transmission, storage, and compression/decompression
- Application data processing, such as file conversion
Encoding can have two meanings:
- In computer technology, encoding is the process of applying a specific code, such as letters, symbols, and numbers, to data for conversion into an equivalent cipher.
- In electronics, encoding refers to analog to digital conversion.
Even, Encoding and decoding are often used in reference to the processes of analog-to-digital and digital-to-analog conversion.
Encoding and decoding are commonly used in data communications, networking, and storage.
Encoding is also used to reduce the size of audio and video files. Each audio and video file format has a corresponding coder-decoder (codec) program.
Base64 encoding is nothing but binary to text encoding.