简体   繁体   English

在其他设备上解码base64加密

[英]Decoding a base64 encryption on other device

I am using python build in library to encode a md5 digest using base 64. Library i am using is : 我正在库中使用python build来使用base 64编码md5摘要。我正在使用的库是:

      from hashlib import md5

My code to encode the "email" variable: 我的编码“ email”变量的代码:

     apitoken = md5(email).digest().encode('base64')[:-1]

Now the problem is this "apitoken" is being sent to other device who need to decode the base64 it to get email md5. 现在的问题是,此“ apitoken”被发送到其他设备,这些设备需要对base64进行解码以获取电子邮件md5。

What key should I send to them? 我应该发给他们什么钥匙? Where is this salt value? 这个盐值在哪里?

If your requirement is to send encrypted data then you should not use a one-way hashing algorithm like MD5 (which is a weak algorithm, in any case). 如果您的要求是发送加密的数据,则不应使用像MD5这样的单向散列算法(在任何情况下都是弱算法)。 I would recommend using well known symmetric/asymmetric algorithms like AES say from the Python Cryptography Toolkit (pycrypto) 我建议使用Python密码学工具包(pycrypto)中众所周知的对称/非对称算法,例如AES。

The encrypted data can be unencrypted at the client end using an appropriate client library for that algorithm. 可以使用该算法的适当客户端库在客户端对加密的数据进行解密。 I would also recommend reading a good book on security such as Bruce Schneier's "Applied Cryptography" to understand how to build a secure system. 我还建议阅读一本关于安全性的好书,例如Br​​uce Schneier的“应用密码学”,以了解如何构建安全的系统。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM