dongluo3962 2013-07-31 05:47
浏览 30

生成唯一的密钥以识别系统

I need to generate a unique identifier based on some information. There will be multiple clients and one server. Each client will call a web service at server for the first time registration. Each client will send system name (considered to be unique), logged in user name, date of registration, mac-address (probable) etc.

Based on this information, I want to generate a unique identifier for that particular user. My Server is written in PHP. I know some hash methods can generate some unique key, but what is the standard and what is being used generally?

Thanks for help.

  • 写回答

2条回答 默认 最新

  • douhuan9289 2013-07-31 05:57
    关注

    An effective approach to this is to add a salt (a few characters known only to the server) to the concatenated details from the clients. Take a hash of that data. In the example below, the salt is mysalt.

    <?php
    echo hash('ripemd160', 'mysalt' . clientHostname . clientUsername . clientRegistrationDate);
    ?>
    

    This approach means that the hash can't easily be guessed/reverse-engineered by a third party.

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?