[英]Return sha1() hash from couchdb
I have some data stored in CouchDb of the form key-value .我有一些数据以key-value形式存储在 CouchDb 中。 Basically it a tuple with a value and salt.
基本上它是一个带有值和盐的元组。 I have created a view that return these tuples and calculate the sha1() of the value + salt on the client side using javascript.
我创建了一个视图,该视图返回这些元组并使用 javascript 在客户端计算值+ salt的 sha1()。 Is it possible to send the sha1() hash of value + salt directly from CouchDb as JSON?
是否可以直接从 CouchDb 作为 JSON 发送价值+盐的 sha1() hash? I do not wish to send the salt to the client.
我不希望将盐发送给客户。 Thanks.
谢谢。
I suggest a Javascript SHA1 [1] implementation directly on CouchDB.我建议直接在 CouchDB 上实现 Javascript SHA1 [1]。 I think you have two options:
我认为你有两个选择:
_list
function._list
function 中的校验和。 Query speed will be (in principle) slower, since you execute code for every row for every query; There is an SHA1 Javascript implementation in CouchDB, Point your browser to your Couch server, in /_utils/script/sha1.js
. CouchDB 中有一个 SHA1 Javascript 实现,将您的浏览器指向您的 Couch 服务器,位于
/_utils/script/sha1.js
中。 You can copy and paste the code if you want.如果需要,您可以复制并粘贴代码。
[1] Or consider SHA256 or SHA512 if possible. [1] 或者尽可能考虑 SHA256 或 SHA512。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.