@ChezCoder To store passwords, it's normal to use one way encryption (hashing). This means that you can encrypt the data, but it's impossible to decrypt it. However, whenever you want to log a user in you can just find the hash for the value of their password and then check that against the stored hash. You can do this pretty easily with the Stanford JS Crypto Module. Try an algorithm like sha-256 or sha-512.
You can also use the built in crypto module's createHash function.
@ChezCoder @CaptainAnon You can "unhash" a hash using brute force. However, there is some overlap between original values and hashes due to predefined hash lengths.
@ChezCoder Yes. If you are encoding stuff like that, I'd recommend using the Diffie-Hellman Key Exchange or RSA. Both are in my Cryptography 101 post if you want to learn more.
Maybe the built in crypto module would do the trick?
@CaptainAnon @CaptainAnon yeah, i checked it but the examples didnt help. I didn't get it
@ChezCoder Cryptography is a pretty big and complicated field. What are you trying to do?
@CaptainAnon a basic password encrypt and decryption
@ChezCoder To store passwords, it's normal to use one way encryption (hashing). This means that you can encrypt the data, but it's impossible to decrypt it. However, whenever you want to log a user in you can just find the hash for the value of their password and then check that against the stored hash. You can do this pretty easily with the Stanford JS Crypto Module. Try an algorithm like sha-256 or sha-512.
You can also use the built in crypto module's
createHash
function.@CaptainAnon thank you, though I am aware of that method. I want to know how to "unhash" or decrypt an encrypted value using ciphers
@ChezCoder You can't "unhash" a hash. For two way encryption you could use something like RSA (for sending messages between parties).
@CaptainAnon yes, i know. which is why I want to learn how to use ciphers.
Try the builtin crypto module.
@CaptainAnon ok. its a bit confusing though, can you maybe get me a snippet? Thanks :P
@ChezCoder @CaptainAnon You can "unhash" a hash using brute force. However, there is some overlap between original values and hashes due to predefined hash lengths.
@AmazingMech2418 yes but this would be really hard when dealing with things like bios or long strings of text that involve special chars etc
@ChezCoder Yes. If you are encoding stuff like that, I'd recommend using the Diffie-Hellman Key Exchange or RSA. Both are in my Cryptography 101 post if you want to learn more.
@AmazingMech2418 ok... or I can just use my encryption library in python: https://repl.it/@ChezCoder/aCrypt
https://pypi.org/project/aCrypt/
@ChezCoder Well, not if you are using Node...
@AmazingMech2418 yes but I was thinking about passing info to python then getting the encrypted code / decrypted code back
@ChezCoder By the way, what algorithm did you use in your aCrypt library? It looks like maybe a modified Caesar Cipher?
@AmazingMech2418 no, i can show you: https://repl.it/join/jiioujpf-chezcoder