SHA1散列SQLite中:怎么了?

编程入门 行业动态 更新时间:2024-10-27 20:31:02
本文介绍了SHA1散列SQLite中:怎么了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在平行的几个区议会的工作和需要散列口令来初始化一些记录。在 MS SQL服务器有方便的功能,允许散列动态:

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'))

是否有与的SQLite ?

如果不是,这是最简单的解决方法(如选择从 SQL服务器并以某种方式将其插入的SQLite 表)?

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

在preferred散列算法 SHA1 和密码存储在 BLOB 列。

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

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

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

推荐答案

有是内置的SQLite3没有这种功能。

There is no such function built into SQLite3.

但是你可以如定义用户的功能与 sqlite3_create_function 如果你使用的C接口,并实现SHA-1这一点。 (但如果你有一个可编程接口也许你可以只SHA-1的SQL引擎外的密码。)

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.)

您也可以尝试查找/创建扩展和负载的 load_extension 功能,但我没有这些经验。

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

编辑:

  • 见this回答的 SQLiteFunction简单不工作的如何在C#中定义与 System.Data.SQLite 自定义函数。
  • 使用System.Security.Cryptography.SHA1计算SHA-1散列。
  • See this answer on SQLiteFunction Simple Not Working for how to define a custom function with System.Data.SQLite in C#.
  • Use System.Security.Cryptography.SHA1 to compute the SHA-1 hash.

更多推荐

SHA1散列SQLite中:怎么了?

本文发布于:2023-10-14 22:51:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492447.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SQLite

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!