[英]Difference between SALT and KEY. Encryption
Alright, so im trying to learn a little about Encrypting messages in my java application. 好吧,所以我试着在我的java应用程序中学习加密消息。 I just found out that SALT and KEY aren't the same.
我刚刚发现SALT和KEY不一样。
Can someone help me understand what the difference between the two is? 有人能帮助我理解两者之间的区别是什么吗?
The key is, crudely, the equivalent of a password; 关键是粗略地相当于密码; you use it to encrypt a message, and then the same key gets used to decrypt it back to the original plaintext.
您使用它来加密消息,然后使用相同的密钥将其解密回原始明文。 (Well, it gets a little more complex, once you have public and private keys, and so on.)
(嗯,一旦你有公钥和私钥,它会变得有点复杂,等等。)
A salt is most typically encountered with cryptographic hash functions, not encryption functions. 盐是最典型的是用加密散列函数,没有加密功能,遇到。 The idea is that rather than hashing just your data (eg a password), you hash data+salt, where salt is typically a randomly-generated string.
我们的想法是,不是散列数据(例如密码),而是散列数据+ salt,其中salt通常是随机生成的字符串。 They have (at least) two purposes:
他们(至少)有两个目的:
The key is essentially the password with which you lock the original content. 密钥本质上是用于锁定原始内容的密码。
To make the password more difficult to reverse engineer, you can add a salt to the produced encryption. 要使密码更难以进行逆向工程,可以在生成的加密中添加salt 。
This really comes into use when you iteratively encrypt , eg, 这在迭代加密时真正开始使用,例如,
result = salt + encrypt(salt+encrypt(salt+encrypt(message))). result = salt + encrypt(salt + encrypt(salt + encrypt(message)))。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.