我已经在magento和node js中创建了登录服务。在magento中,如果客户使用密码注册,则使用md5盐密钥值对密码进行加密。如果我使用crypto node js模块来解密magento密码,它会抛出错误。
Error: Unknown cipher
at Error (native)
at new Decipher (crypto.js:210:16)
at Object.Decipher (crypto.js:207:12)
at D:\Workspace\mobileapp\routes\users.js:30:24
at Layer.h
我想用md5加密一个字符串值,然后解密它,这样就可以用密钥了。所以我搜索了如何做到这一点,我只找到了另一种算法。
这是加密类:
class crypt
{
public string encrypt(string bhash)
{
MD5 md5 = new MD5CryptoServiceProvider();
md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(bhash));
byte[] result = md5.Hash;
我有下面的代码。
String plaintext = "HelloWorld";
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(plaintext.getBytes());
byte[] digest = m.digest();
BigInteger bigInt = new BigInteger(1,digest);
String hashtext = bigInt.toString(16);
// Now we need to zero pad it if
我使用这两个函数加密/解密文件:
private function encrypt_file($source,$destination,$passphrase,$stream=NULL) {
// $source can be a local file...
if($stream) {
$contents = $source;
// OR $source can be a stream if the third argument ($stream flag) exists.
}else{
$handle = fop