1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Files
sqlite/test/sha1.sql
drh 67cfb59334 Fix the sha1() extension function so that it interprets zero-length
BLOBs as BLOBs and not as NULL.  Also add a few test cases for that
extension function, which was previously completely untested.
[bugs:/info/2026-07-29T06:31:41Z|Bug 2026-07-29T06:31:41Z].

FossilOrigin-Name: 978d12de384fef985d0363633566304bb20f452dfe8ceb836ca1d353a135f30a
2026-07-29 10:28:44 +00:00

35 lines
985 B
SQL

#!sqlite3
#
# 2026-07-29
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test cases for the sha1(), sha1b() functions.
#
.mode list -reset
.testcase 100
SELECT sha1('this is a test');
.check fa26be19de6bff93f70bc2308434e4a440bbad02
.testcase 110
SELECT hex(sha1b('this is a test'));
.check FA26BE19DE6BFF93F70BC2308434E4A440BBAD02
.testcase 120
SELECT sha1(x'31323334353637383930');
.check 01b307acba4f54f55aafc33bb06bbbf6ca803e9a
.testcase 130
SELECT sha1(12345*100000 + 67890);
.check 01b307acba4f54f55aafc33bb06bbbf6ca803e9a
.testcase 140
SELECT sha1('');
.check da39a3ee5e6b4b0d3255bfef95601890afd80709
.testcase 150
SELECT sha1(x'');
.check da39a3ee5e6b4b0d3255bfef95601890afd80709