[英]Checking JSON file integrity
So basically I need some kind of hashing technique to get a key unique to a JSON string that I can check to see if the JSON cached on the client is the same as the one stored on the server. 因此,基本上,我需要某种哈希技术来获取JSON字符串唯一的密钥,我可以检查该密钥以查看客户端上缓存的JSON是否与服务器上存储的JSON相同。 The server will send that hash first to the client and only if it differs from the one generated from the client cache, then the client will request the whole JSON from the server again. 服务器将首先将该哈希发送给客户端,并且仅当该哈希与从客户端缓存生成的哈希不同时,客户端才会再次从服务器请求整个JSON。
If your looking for a simple hash why not just use an MD5 hash? 如果您要查找简单的哈希,为什么不只使用MD5哈希呢? https://msdn.microsoft.com/en-us/library/system.security.cryptography.md5%28v=vs.110%29.aspx basic hash that is easy to implement and use. https://msdn.microsoft.com/zh-cn/library/system.security.cryptography.md5%28v=vs.110%29.aspx易于实现和使用的基本哈希。
If you are looking to do an MD5 hash on the client using JS you might want to look at https://github.com/blueimp/JavaScript-MD5 (Non-tested by me, but I have heard good things :) 如果您希望使用JS在客户端上进行MD5哈希处理,则可能需要查看https://github.com/blueimp/JavaScript-MD5 (未经我测试,但我听过好消息:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.