<?php
    function renewCode( $schoolName, $certId, $barcode, $indate ){
       return strtoupper( substr( md5( $schoolName.$certId.$barcode.$indate ), 3, 8 ) );
   }
?>

I don't understand the function of MD5()。I mean I know the school Name and all of data but I can not get the right return like that

我不明白MD5()的功能。我的意思是我知道学校名称和所有数据,但我无法得到正确的回报

For example:

the right return: 19B55890

正确的回报:19B55890

Md5 encryption that string "xxxxxxxx.xxxxxxxxx.01187422.2013-03-20"

字符串“xxxxxxxx.xxxxxxxxx.01187422.2013-03-20”的Md5加密

   CBBDFC8D228B7FCFECCFC54FBB3C9D87

it's did not equal 19B55890

它不等于19B55890

1 个解决方案

#1


$schoolName.$certId.$barcode.$indate does not have . chars in the output - that's the concatenate operator. That input gives a string of:

$ schoolName。$ certId。$ barcode。$ indate没有。输出中的字符 - 这是连接运算符。该输入给出了一串:

大连民族学院图书馆2012081507011874222013-03-20

which when hashed, gives:

当哈希时,给出:

a6019b5589029bf9378cfff4c631fc7d

The substring 3,8 of which is:

子串3,8是:

19b55890

Also note that MD5 is not encryption, it's a one way hash of the input string. It's also considered fairly insecure now; it's recommended to use SHA-256 based hashes if you're able to switch.

另请注意,MD5不是加密,它是输入字符串的单向散列。它现在也被认为是相当不安全的;如果你能够切换,建议使用基于SHA-256的哈希。

更多相关文章

  1. 在两个不同的地方分割/爆炸一个PHP字符串
  2. PHP中的嵌套(多个)字符串插值
  3. 查找具有特定数据字符串的数组并返回其具有的另一个数据字符串
  4. 在php中,从字符串中删除逗号后的所有内容
  5. 如何通过PHP将HTML页面作为字符串获取?
  6. php 基本的常用字符串函数
  7. 用PHP计算字符串中元音的简单方法?
  8. 将DOMDocument中的特定元素导出为字符串
  9. PHP实现字符串转换成查询语句

随机推荐

  1. Deploying OpenFire for IM (instant mes
  2. PHP基础教程十四之使用MySqli操作数据库
  3. python中sqlite问题和坑
  4. Sql Server 2012 存储过程Demo1
  5. Django ORM - 获取组的最新记录
  6. SQLException:没有适合jdbc的驱动程序:de
  7. 记录不一致的数量-只改变是排序。
  8. 如何将表(及其行,列和单元格)保存在SQL数据
  9. Sql2005中,恢复数据库时,旁边显示“restric
  10. 在windows主机安装mysql(安装包和安装步骤