我想在 PHP 中制作一个散列文本的个人算法。 'xyz'中的字母'a'地穴,'256'中的'b'等等。这怎么可能?
最佳答案
可以通过简单地创建一个函数来进行字符替换,如下所示:
function myEncrypt ($text)
{
$text = str_replace(array('a', 'b'), array('xby', '256'), $text);
// ... others
return $text;
}
带有两个数组“search”和“replaceWith”作为参数传递的版本:
function myEncrypt ($text, $search=array(), $replaceWith=array())
{
return str_replace($search, $replaceWith, $text);
}
WARNING: That way isn't a correct solution to encrypt a text, there are a lot of better ways to do a secure encryption with PHP (see for example this post).
关于php - 如何在 PHP 中制作个人哈希算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48337821/