strings.slt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Copyright 1994, Regents of the University of California.
  2. # Copyright 1996-2022 PostgreSQL Global Development Group.
  3. # Copyright Materialize, Inc. and contributors. All rights reserved.
  4. #
  5. # Use of this software is governed by the Business Source License
  6. # included in the LICENSE file at the root of this repository.
  7. #
  8. # As of the Change Date specified in that file, in accordance with
  9. # the Business Source License, use of this software will be governed
  10. # by the Apache License, Version 2.0.
  11. #
  12. # This file is derived from the regression test suite in PostgreSQL.
  13. # The original file was retrieved on February 3, 2022 from:
  14. #
  15. # https://github.com/postgres/postgres/blob/d33a81203e95d31e62157c4ae0e00e2198841208/src/test/regress/expected/strings.out
  16. #
  17. # The original source code is subject to the terms of the PostgreSQL
  18. # license, a copy of which can be found in the LICENSE file at the
  19. # root of this repository.
  20. # At the time of writing this file contains only PostgreSQL's
  21. # hash-function-related string tests, which constitute only a small fraction of
  22. # the available string tests upstream.
  23. mode cockroach
  24. # MD5 test suite - from IETF RFC 1321
  25. # (see: ftp://ftp.rfc-editor.org/in-notes/rfc1321.txt)
  26. statement ok
  27. CREATE TABLE md5_test (t text)
  28. statement ok
  29. INSERT INTO md5_test VALUES
  30. (''),
  31. ('a'),
  32. ('abc'),
  33. ('message digest'),
  34. ('abcdefghijklmnopqrstuvwxyz'),
  35. ('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'),
  36. ('12345678901234567890123456789012345678901234567890123456789012345678901234567890')
  37. query T rowsort
  38. SELECT md5(t) FROM md5_test ORDER BY t
  39. ----
  40. d41d8cd98f00b204e9800998ecf8427e
  41. 0cc175b9c0f1b6a831c399e269772661
  42. 900150983cd24fb0d6963f7d28e17f72
  43. f96b697d7cb7938d525a2f31aaf161d0
  44. c3fcd3d76192e4007dfb496cca67e13b
  45. d174ab98d277d9f5a5611c2c9f419d9f
  46. 57edf4a22be3c955ac49da2e2107b67a
  47. query I
  48. SELECT count(*) FROM md5_test WHERE md5(t) <> md5(t::bytea)
  49. ----
  50. 0
  51. # SHA-2
  52. query T
  53. SELECT sha224('')::text
  54. ----
  55. \xd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f
  56. query T
  57. SELECT sha224('The quick brown fox jumps over the lazy dog.')::text
  58. ----
  59. \x619cba8e8e05826e9b8c519c0a5c68f4fb653e8a3d8aa04bb2c8cd4c
  60. query T
  61. SELECT sha256('')::text
  62. ----
  63. \xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
  64. query T
  65. SELECT sha256('The quick brown fox jumps over the lazy dog.')::text
  66. ----
  67. \xef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c
  68. query T
  69. SELECT sha384('')::text
  70. ----
  71. \x38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b
  72. query T
  73. SELECT sha384('The quick brown fox jumps over the lazy dog.')::text
  74. ----
  75. \xed892481d8272ca6df370bf706e4d7bc1b5739fa2177aae6c50e946678718fc67a7af2819a021c2fc34e91bdb63409d7
  76. query T
  77. SELECT sha512('')::text
  78. ----
  79. \xcf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
  80. query T
  81. SELECT sha512('The quick brown fox jumps over the lazy dog.')::text
  82. ----
  83. \x91ea1245f20d46ae9a037a989f54f1f790f0a47607eeb8a14d12890cea77a1bbc6c7ed9cf205e67b7f2b8fd4c7dfd3a7a8617e45f3c463d481c7e586c39ac1ed