SQLA1中的SHA1哈希:怎么样? [英] SHA1 hashing in SQLite: how?

查看:209
本文介绍了SQLA1中的SHA1哈希:怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

并行使用多个数据库,需要使用哈希密码初始化一些记录。在 MS SQL服务器中有一些方便的功能可以实时哈希:

  
HashBytes('SHA1',CONVERT(nvarchar(32),N'admin'))

是否有类似的函数 SQLite



如果没有,这是最简单的解决方法(例如选择 SQL server ,并以某种方式将其插入 SQLite 表)?



首选散列算法是 SHA1 ,密码存储在 BLOB 列中。 / p>

更新:我在当前项目中使用C#语言。

解决方案

SQLite3中没有内置这样的函数。



但您可以定义一个用户函数。 sqlite3_create_function 如果您重新使用C接口,并实现SHA-1。 (但是如果你有一个可编程的接口,你可以只是SHA-1的SQL引擎之外的密码。)



你也可以尝试找到/创建扩展和加载 load_extension 函数




Working with several DBs in parallel and need to initialize some records with hashed passwords. In MS SQL server there are handy functions that allow to hash on the fly:


HashBytes('SHA1', CONVERT(nvarchar(32), N'admin'))

Is there is a similar function with SQLite?

If not, which is the easiest workaround (such as select from SQL server and somehow insert it into SQLite tables)?

The preferred hashing algorithm is SHA1 and the passwords are stored in a BLOB column.

Update: I use C# language in the current project.

解决方案

There is no such function built into SQLite3.

But you could define a user function e.g. with sqlite3_create_function if you're using the C interface, and implement SHA-1 with that. (But if you're having a programmable interface perhaps you could just SHA-1 the password outside of the SQL engine.)

You could also try to find / create an extension and load with the load_extension function, but I don't have experience on that.

Edit:

这篇关于SQLA1中的SHA1哈希:怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆