xcrypt 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +106 -0
  3. data/ext/libxcrypt/AUTHORS +38 -0
  4. data/ext/libxcrypt/COPYING.LIB +502 -0
  5. data/ext/libxcrypt/ChangeLog +239 -0
  6. data/ext/libxcrypt/INSTALL +380 -0
  7. data/ext/libxcrypt/LICENSING +152 -0
  8. data/ext/libxcrypt/Makefile.am +704 -0
  9. data/ext/libxcrypt/Makefile.in +4110 -0
  10. data/ext/libxcrypt/NEWS +630 -0
  11. data/ext/libxcrypt/README +1 -0
  12. data/ext/libxcrypt/README.md +179 -0
  13. data/ext/libxcrypt/THANKS +13 -0
  14. data/ext/libxcrypt/TODO +1 -0
  15. data/ext/libxcrypt/TODO.md +100 -0
  16. data/ext/libxcrypt/aclocal.m4 +2617 -0
  17. data/ext/libxcrypt/autogen.sh +33 -0
  18. data/ext/libxcrypt/autom4te.cache/output.0 +19884 -0
  19. data/ext/libxcrypt/autom4te.cache/output.1 +19884 -0
  20. data/ext/libxcrypt/autom4te.cache/output.2 +19884 -0
  21. data/ext/libxcrypt/autom4te.cache/output.3 +19885 -0
  22. data/ext/libxcrypt/autom4te.cache/requests +714 -0
  23. data/ext/libxcrypt/autom4te.cache/traces.0 +4088 -0
  24. data/ext/libxcrypt/autom4te.cache/traces.1 +1060 -0
  25. data/ext/libxcrypt/autom4te.cache/traces.2 +4088 -0
  26. data/ext/libxcrypt/autom4te.cache/traces.3 +1060 -0
  27. data/ext/libxcrypt/build-aux/ci/ci-log-dependency-versions +79 -0
  28. data/ext/libxcrypt/build-aux/ci/ci-log-logfiles +22 -0
  29. data/ext/libxcrypt/build-aux/ci/clang-gcov-wrapper +2 -0
  30. data/ext/libxcrypt/build-aux/ci/configure-wrapper +10 -0
  31. data/ext/libxcrypt/build-aux/ci/summarize-coverage +24 -0
  32. data/ext/libxcrypt/build-aux/m4/ax_append_compile_flags.m4 +46 -0
  33. data/ext/libxcrypt/build-aux/m4/ax_append_flag.m4 +50 -0
  34. data/ext/libxcrypt/build-aux/m4/ax_check_compile_flag.m4 +53 -0
  35. data/ext/libxcrypt/build-aux/m4/ax_check_vscript.m4 +142 -0
  36. data/ext/libxcrypt/build-aux/m4/ax_gcc_func_attribute.m4 +246 -0
  37. data/ext/libxcrypt/build-aux/m4/ax_require_defined.m4 +37 -0
  38. data/ext/libxcrypt/build-aux/m4/ax_valgrind_check.m4 +239 -0
  39. data/ext/libxcrypt/build-aux/m4/libtool.m4 +8488 -0
  40. data/ext/libxcrypt/build-aux/m4/ltoptions.m4 +467 -0
  41. data/ext/libxcrypt/build-aux/m4/ltsugar.m4 +124 -0
  42. data/ext/libxcrypt/build-aux/m4/ltversion.m4 +24 -0
  43. data/ext/libxcrypt/build-aux/m4/lt~obsolete.m4 +99 -0
  44. data/ext/libxcrypt/build-aux/m4/pkg_compat.m4 +88 -0
  45. data/ext/libxcrypt/build-aux/m4/zw_alignment.m4 +90 -0
  46. data/ext/libxcrypt/build-aux/m4/zw_automodern.m4 +307 -0
  47. data/ext/libxcrypt/build-aux/m4/zw_detect_asan.m4 +24 -0
  48. data/ext/libxcrypt/build-aux/m4/zw_endianness.m4 +152 -0
  49. data/ext/libxcrypt/build-aux/m4/zw_ld_wrap.m4 +47 -0
  50. data/ext/libxcrypt/build-aux/m4/zw_prog_perl.m4 +40 -0
  51. data/ext/libxcrypt/build-aux/m4/zw_simple_warnings.m4 +150 -0
  52. data/ext/libxcrypt/build-aux/m4/zw_static_assert.m4 +68 -0
  53. data/ext/libxcrypt/build-aux/m4-autogen/compile +364 -0
  54. data/ext/libxcrypt/build-aux/m4-autogen/config.guess +1815 -0
  55. data/ext/libxcrypt/build-aux/m4-autogen/config.sub +2354 -0
  56. data/ext/libxcrypt/build-aux/m4-autogen/depcomp +792 -0
  57. data/ext/libxcrypt/build-aux/m4-autogen/install-sh +541 -0
  58. data/ext/libxcrypt/build-aux/m4-autogen/ltmain.sh +11524 -0
  59. data/ext/libxcrypt/build-aux/m4-autogen/missing +236 -0
  60. data/ext/libxcrypt/build-aux/m4-autogen/test-driver +160 -0
  61. data/ext/libxcrypt/build-aux/scripts/BuildCommon.pm +712 -0
  62. data/ext/libxcrypt/build-aux/scripts/check-perlcritic-config +76 -0
  63. data/ext/libxcrypt/build-aux/scripts/compute-symver-floor +116 -0
  64. data/ext/libxcrypt/build-aux/scripts/expand-selected-hashes +80 -0
  65. data/ext/libxcrypt/build-aux/scripts/gen-crypt-h +131 -0
  66. data/ext/libxcrypt/build-aux/scripts/gen-crypt-hashes-h +141 -0
  67. data/ext/libxcrypt/build-aux/scripts/gen-crypt-symbol-vers-h +150 -0
  68. data/ext/libxcrypt/build-aux/scripts/gen-libcrypt-map +67 -0
  69. data/ext/libxcrypt/build-aux/scripts/move-if-change +84 -0
  70. data/ext/libxcrypt/build-aux/scripts/skip-if-exec-format-error +78 -0
  71. data/ext/libxcrypt/codecov.yml +4 -0
  72. data/ext/libxcrypt/config.h.in +303 -0
  73. data/ext/libxcrypt/configure +19885 -0
  74. data/ext/libxcrypt/configure.ac +549 -0
  75. data/ext/libxcrypt/doc/crypt.3 +512 -0
  76. data/ext/libxcrypt/doc/crypt.5 +343 -0
  77. data/ext/libxcrypt/doc/crypt_checksalt.3 +106 -0
  78. data/ext/libxcrypt/doc/crypt_gensalt.3 +285 -0
  79. data/ext/libxcrypt/doc/crypt_gensalt_ra.3 +1 -0
  80. data/ext/libxcrypt/doc/crypt_gensalt_rn.3 +1 -0
  81. data/ext/libxcrypt/doc/crypt_preferred_method.3 +68 -0
  82. data/ext/libxcrypt/doc/crypt_r.3 +1 -0
  83. data/ext/libxcrypt/doc/crypt_ra.3 +1 -0
  84. data/ext/libxcrypt/doc/crypt_rn.3 +1 -0
  85. data/ext/libxcrypt/lib/alg-des-tables.c +3858 -0
  86. data/ext/libxcrypt/lib/alg-des.c +269 -0
  87. data/ext/libxcrypt/lib/alg-des.h +74 -0
  88. data/ext/libxcrypt/lib/alg-gost3411-2012-const.h +313 -0
  89. data/ext/libxcrypt/lib/alg-gost3411-2012-core.c +238 -0
  90. data/ext/libxcrypt/lib/alg-gost3411-2012-core.h +51 -0
  91. data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.c +78 -0
  92. data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.h +46 -0
  93. data/ext/libxcrypt/lib/alg-gost3411-2012-precalc.h +1426 -0
  94. data/ext/libxcrypt/lib/alg-gost3411-2012-ref.h +67 -0
  95. data/ext/libxcrypt/lib/alg-hmac-sha1.c +140 -0
  96. data/ext/libxcrypt/lib/alg-hmac-sha1.h +35 -0
  97. data/ext/libxcrypt/lib/alg-md4.c +270 -0
  98. data/ext/libxcrypt/lib/alg-md4.h +43 -0
  99. data/ext/libxcrypt/lib/alg-md5.c +291 -0
  100. data/ext/libxcrypt/lib/alg-md5.h +43 -0
  101. data/ext/libxcrypt/lib/alg-sha1.c +288 -0
  102. data/ext/libxcrypt/lib/alg-sha1.h +34 -0
  103. data/ext/libxcrypt/lib/alg-sha256.c +630 -0
  104. data/ext/libxcrypt/lib/alg-sha256.h +123 -0
  105. data/ext/libxcrypt/lib/alg-sha512.c +311 -0
  106. data/ext/libxcrypt/lib/alg-sha512.h +81 -0
  107. data/ext/libxcrypt/lib/alg-sm3-hmac.c +113 -0
  108. data/ext/libxcrypt/lib/alg-sm3-hmac.h +42 -0
  109. data/ext/libxcrypt/lib/alg-sm3.c +449 -0
  110. data/ext/libxcrypt/lib/alg-sm3.h +63 -0
  111. data/ext/libxcrypt/lib/alg-yescrypt-common.c +713 -0
  112. data/ext/libxcrypt/lib/alg-yescrypt-opt.c +1568 -0
  113. data/ext/libxcrypt/lib/alg-yescrypt-platform.c +106 -0
  114. data/ext/libxcrypt/lib/alg-yescrypt.h +360 -0
  115. data/ext/libxcrypt/lib/byteorder.h +164 -0
  116. data/ext/libxcrypt/lib/crypt-bcrypt.c +1061 -0
  117. data/ext/libxcrypt/lib/crypt-des-obsolete.c +215 -0
  118. data/ext/libxcrypt/lib/crypt-des.c +491 -0
  119. data/ext/libxcrypt/lib/crypt-gensalt-static.c +40 -0
  120. data/ext/libxcrypt/lib/crypt-gost-yescrypt.c +182 -0
  121. data/ext/libxcrypt/lib/crypt-md5.c +232 -0
  122. data/ext/libxcrypt/lib/crypt-nthash.c +134 -0
  123. data/ext/libxcrypt/lib/crypt-obsolete.h +40 -0
  124. data/ext/libxcrypt/lib/crypt-pbkdf1-sha1.c +260 -0
  125. data/ext/libxcrypt/lib/crypt-port.h +514 -0
  126. data/ext/libxcrypt/lib/crypt-scrypt.c +247 -0
  127. data/ext/libxcrypt/lib/crypt-sha256.c +308 -0
  128. data/ext/libxcrypt/lib/crypt-sha512.c +323 -0
  129. data/ext/libxcrypt/lib/crypt-sm3-yescrypt.c +189 -0
  130. data/ext/libxcrypt/lib/crypt-sm3.c +308 -0
  131. data/ext/libxcrypt/lib/crypt-static.c +44 -0
  132. data/ext/libxcrypt/lib/crypt-sunmd5.c +314 -0
  133. data/ext/libxcrypt/lib/crypt-yescrypt.c +177 -0
  134. data/ext/libxcrypt/lib/crypt.c +421 -0
  135. data/ext/libxcrypt/lib/crypt.h.in +249 -0
  136. data/ext/libxcrypt/lib/gen-des-tables.c +363 -0
  137. data/ext/libxcrypt/lib/hashes.conf +59 -0
  138. data/ext/libxcrypt/lib/libcrypt.map.in +48 -0
  139. data/ext/libxcrypt/lib/libcrypt.minver +97 -0
  140. data/ext/libxcrypt/lib/libxcrypt.pc.in +15 -0
  141. data/ext/libxcrypt/lib/util-base64.c +26 -0
  142. data/ext/libxcrypt/lib/util-gensalt-sha.c +88 -0
  143. data/ext/libxcrypt/lib/util-get-random-bytes.c +154 -0
  144. data/ext/libxcrypt/lib/util-make-failure-token.c +48 -0
  145. data/ext/libxcrypt/lib/util-xbzero.c +43 -0
  146. data/ext/libxcrypt/lib/util-xstrcpy.c +42 -0
  147. data/ext/libxcrypt/lib/xcrypt.h.in +58 -0
  148. data/ext/libxcrypt/libxcrypt.spec.rpkg +481 -0
  149. data/ext/libxcrypt/rpkg.conf +2 -0
  150. data/ext/libxcrypt/rpkg.macros +86 -0
  151. data/ext/libxcrypt/test/TestCommon.pm +326 -0
  152. data/ext/libxcrypt/test/alg-des.c +80 -0
  153. data/ext/libxcrypt/test/alg-gost3411-2012-hmac.c +90 -0
  154. data/ext/libxcrypt/test/alg-gost3411-2012.c +191 -0
  155. data/ext/libxcrypt/test/alg-hmac-sha1.c +187 -0
  156. data/ext/libxcrypt/test/alg-md4.c +111 -0
  157. data/ext/libxcrypt/test/alg-md5.c +134 -0
  158. data/ext/libxcrypt/test/alg-pbkdf-hmac-sha256.c +269 -0
  159. data/ext/libxcrypt/test/alg-sha1.c +111 -0
  160. data/ext/libxcrypt/test/alg-sha256.c +141 -0
  161. data/ext/libxcrypt/test/alg-sha512.c +170 -0
  162. data/ext/libxcrypt/test/alg-sm3-hmac.c +149 -0
  163. data/ext/libxcrypt/test/alg-sm3.c +168 -0
  164. data/ext/libxcrypt/test/alg-yescrypt.c +466 -0
  165. data/ext/libxcrypt/test/badsalt.c +726 -0
  166. data/ext/libxcrypt/test/badsetting.c +350 -0
  167. data/ext/libxcrypt/test/byteorder.c +254 -0
  168. data/ext/libxcrypt/test/checksalt.c +265 -0
  169. data/ext/libxcrypt/test/compile-strong-alias.c +43 -0
  170. data/ext/libxcrypt/test/crypt-badargs.c +392 -0
  171. data/ext/libxcrypt/test/crypt-gost-yescrypt.c +149 -0
  172. data/ext/libxcrypt/test/crypt-nested-call.c +180 -0
  173. data/ext/libxcrypt/test/crypt-sm3-yescrypt.c +149 -0
  174. data/ext/libxcrypt/test/crypt-too-long-phrase.c +157 -0
  175. data/ext/libxcrypt/test/des-cases.h +196 -0
  176. data/ext/libxcrypt/test/des-obsolete.c +206 -0
  177. data/ext/libxcrypt/test/des-obsolete_r.c +207 -0
  178. data/ext/libxcrypt/test/explicit-bzero.c +334 -0
  179. data/ext/libxcrypt/test/gensalt-bcrypt_x.c +54 -0
  180. data/ext/libxcrypt/test/gensalt-extradata.c +246 -0
  181. data/ext/libxcrypt/test/gensalt-nested-call.c +126 -0
  182. data/ext/libxcrypt/test/gensalt-nthash.c +65 -0
  183. data/ext/libxcrypt/test/gensalt.c +599 -0
  184. data/ext/libxcrypt/test/getrandom-fallbacks.c +295 -0
  185. data/ext/libxcrypt/test/getrandom-interface.c +211 -0
  186. data/ext/libxcrypt/test/ka-table-gen.py +945 -0
  187. data/ext/libxcrypt/test/ka-table.inc +5849 -0
  188. data/ext/libxcrypt/test/ka-tester.c +240 -0
  189. data/ext/libxcrypt/test/preferred-method.c +133 -0
  190. data/ext/libxcrypt/test/short-outbuf.c +119 -0
  191. data/ext/libxcrypt/test/special-char-salt.c +1160 -0
  192. data/ext/libxcrypt/test/symbols-compat.pl +137 -0
  193. data/ext/libxcrypt/test/symbols-renames.pl +107 -0
  194. data/ext/libxcrypt/test/symbols-static.pl +87 -0
  195. data/ext/xcrypt/xcrypt.c +9 -0
  196. data/lib/xcrypt/ffi.rb +76 -0
  197. data/lib/xcrypt/version.rb +5 -0
  198. data/lib/xcrypt.rb +89 -0
  199. metadata +267 -0
@@ -0,0 +1,249 @@
1
+ /* High-level libcrypt interfaces.
2
+
3
+ Copyright (C) 1991-2017 Free Software Foundation, Inc.
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public License
7
+ as published by the Free Software Foundation; either version 2.1 of
8
+ the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, see
17
+ <https://www.gnu.org/licenses/>. */
18
+
19
+ #ifndef _CRYPT_H
20
+ #define _CRYPT_H 1
21
+
22
+ @BEGIN_DECLS@
23
+
24
+ /* The strings returned by crypt, crypt_r, crypt_rn, and crypt_ra will
25
+ be no longer than this, counting the terminating NUL. (Existing
26
+ algorithms all produce much shorter strings, but we have reserved
27
+ generous space for future expansion.) This is NOT the appropriate
28
+ size to use in allocating the buffer supplied to crypt_rn; use
29
+ sizeof (struct crypt_data) instead. */
30
+ #define CRYPT_OUTPUT_SIZE 384
31
+
32
+ /* Passphrases longer than this (counting the terminating NUL) are not
33
+ supported. Note that some hash algorithms have lower limits. */
34
+ #define CRYPT_MAX_PASSPHRASE_SIZE 512
35
+
36
+ /* The strings returned by crypt_gensalt, crypt_gensalt_rn, and
37
+ crypt_gensalt_ra will be no longer than this. This IS the
38
+ appropriate size to use when allocating the buffer supplied to
39
+ crypt_gensalt_rn. (Again, existing algorithms all produce
40
+ much shorter strings, but we have reserved generous space for
41
+ future expansion.) */
42
+ #define CRYPT_GENSALT_OUTPUT_SIZE 192
43
+
44
+ /* One-way hash the passphrase PHRASE as specified by SETTING, and
45
+ return a string suitable for storage in a Unix-style "passwd" file.
46
+
47
+ If SETTING is a previously hashed passphrase, the string returned
48
+ will be equal to SETTING if and only if PHRASE is the same as the
49
+ passphrase that was previously hashed. See the documentation for
50
+ other ways to use this function.
51
+
52
+ The string returned by this function is stored in a statically-
53
+ allocated buffer, and will be overwritten if the function is called
54
+ again. It is not safe to call this function from multiple threads
55
+ concurrently.
56
+
57
+ If an error occurs (such as SETTING being nonsense or unsupported)
58
+ the string returned will begin with '*', and will not be equal to
59
+ SETTING nor to any valid hashed passphrase. Otherwise, the string
60
+ will not begin with '*'. */
61
+ extern char *crypt (const char *__phrase, const char *__setting)
62
+ __THROW;
63
+
64
+ /* These sizes are chosen to make sizeof (struct crypt_data) add up to
65
+ exactly 32768 bytes. */
66
+ #define CRYPT_DATA_RESERVED_SIZE 767
67
+ #define CRYPT_DATA_INTERNAL_SIZE 30720
68
+
69
+ /* Memory area used by crypt_r. */
70
+ struct crypt_data
71
+ {
72
+ /* crypt_r writes the hashed password to this field of its 'data'
73
+ argument. crypt_rn and crypt_ra do the same, treating the
74
+ untyped data area they are supplied with as this struct. */
75
+ char output[CRYPT_OUTPUT_SIZE];
76
+
77
+ /* Applications are encouraged, but not required, to use this field
78
+ to store the "setting" string that must be passed to crypt_*.
79
+ Future extensions to the API may make this more ergonomic.
80
+
81
+ A valid "setting" is either previously hashed password or the
82
+ string produced by one of the crypt_gensalt functions; see the
83
+ crypt_gensalt documentation for further details. */
84
+ char setting[CRYPT_OUTPUT_SIZE];
85
+
86
+ /* Applications are encouraged, but not required, to use this field
87
+ to store the unhashed passphrase they will pass to crypt_*.
88
+ Future extensions to the API may make this more ergonomic. */
89
+ char input[CRYPT_MAX_PASSPHRASE_SIZE];
90
+
91
+ /* Reserved for future application-visible fields. For maximum
92
+ forward compatibility, applications should set this field to all
93
+ bytes zero before calling crypt_r, crypt_rn, or crypt_ra for the
94
+ first time with a just-allocated 'struct crypt_data'. Future
95
+ extensions to the API may make this more ergonomic. */
96
+ char reserved[CRYPT_DATA_RESERVED_SIZE];
97
+
98
+ /* This field should be set to 0 before calling crypt_r, crypt_rn,
99
+ or crypt_ra for the first time with a just-allocated
100
+ 'struct crypt_data'. This is not required if crypt_ra is allowed
101
+ to do the allocation itself (i.e. if the *DATA argument is a null
102
+ pointer). Future extensions to the API may make this more ergonomic. */
103
+ char initialized;
104
+
105
+ /* Scratch space used internally. Applications should not read or
106
+ write this field. All data written to this area is erased before
107
+ returning from the library. */
108
+ char internal[CRYPT_DATA_INTERNAL_SIZE];
109
+ };
110
+
111
+ /* Thread-safe version of crypt. Instead of writing to a static
112
+ storage area, the string returned by this function will be within
113
+ DATA->output. Otherwise, behaves exactly the same as crypt. */
114
+ extern char *crypt_r (const char *__phrase, const char *__setting,
115
+ struct crypt_data *__restrict __data)
116
+ __THROW;
117
+
118
+ /* Another thread-safe version of crypt. Instead of writing to a
119
+ static storage area, the string returned by this function will be
120
+ somewhere within the space provided at DATA, which is of length SIZE
121
+ bytes. SIZE must be at least sizeof (struct crypt_data).
122
+
123
+ Also, if an error occurs, this function returns a null pointer,
124
+ not a special string. (However, the string returned on success
125
+ still will never begin with '*'.) */
126
+ extern char *crypt_rn (const char *__phrase, const char *__setting,
127
+ void *__data, int __size)
128
+ __THROW;
129
+
130
+ /* Yet a third thread-safe version of crypt; this one works like
131
+ getline(3). *DATA must be either 0 or a pointer to memory
132
+ allocated by malloc, and *SIZE must be the size of the allocation.
133
+ This space will be allocated or reallocated as necessary and the
134
+ values updated. The string returned by this function will be
135
+ somewhere within the space at *DATA. It is safe to deallocate
136
+ this space with free when it is no longer needed.
137
+
138
+ Like crypt_rn, this function returns a null pointer on failure, not
139
+ a special string. */
140
+ extern char *crypt_ra (const char *__phrase, const char *__setting,
141
+ void **__data, int *__size)
142
+ __THROW;
143
+
144
+
145
+ /* Generate a string suitable for use as the setting when hashing a
146
+ new passphrase. PREFIX controls which hash function will be used,
147
+ COUNT controls the computational cost of the hash (for functions
148
+ where this is tunable), and RBYTES should point to NRBYTES bytes of
149
+ random data. If PREFIX is a null pointer, the current best default
150
+ is used; if RBYTES is a null pointer, random data will be retrieved
151
+ from the operating system if possible. (Caution: setting PREFIX to
152
+ an *empty string* selects the use of the oldest and least secure
153
+ hash in the library. Don't do that.)
154
+
155
+ The string returned is stored in a statically-allocated buffer, and
156
+ will be overwritten if the function is called again. It is not
157
+ safe to call this function from multiple threads concurrently.
158
+ However, within a single thread, it is safe to pass the string as
159
+ the SETTING argument to crypt without copying it first; the two
160
+ functions use separate buffers.
161
+
162
+ If an error occurs (e.g. a prefix that does not correspond to a
163
+ supported hash function, or an inadequate amount of random data),
164
+ this function returns a null pointer. */
165
+ extern char *crypt_gensalt (const char *__prefix, unsigned long __count,
166
+ const char *__rbytes, int __nrbytes)
167
+ __THROW;
168
+
169
+ /* Thread-safe version of crypt_gensalt; instead of a
170
+ statically-allocated buffer, the generated setting string is
171
+ written to OUTPUT, which is OUTPUT_SIZE bytes long. OUTPUT_SIZE
172
+ must be at least CRYPT_GENSALT_OUTPUT_SIZE (see above).
173
+
174
+ If an error occurs, this function returns a null pointer and writes
175
+ a string that does not correspond to any valid setting into OUTPUT. */
176
+ extern char *crypt_gensalt_rn (const char *__prefix, unsigned long __count,
177
+ const char *__rbytes, int __nrbytes,
178
+ char *__output, int __output_size)
179
+ __THROW;
180
+
181
+ /* Kept for code compatibility with libxcrypt (v3.1.1 and earlier).
182
+ We intentionally declare the function using a macro here, since
183
+ we actually want to link compiled applications against the
184
+ identical crypt_gensalt_rn function. */
185
+ #ifndef IN_LIBCRYPT /* Defined when building libxcrypt. */
186
+ # ifdef __REDIRECT_NTH
187
+ extern char * __REDIRECT_NTH (crypt_gensalt_r, (const char *__prefix,
188
+ unsigned long __count, const char *__rbytes,
189
+ int __nrbytes, char *__output,
190
+ int __output_size), crypt_gensalt_rn);
191
+ # else
192
+ # define crypt_gensalt_r crypt_gensalt_rn
193
+ # endif
194
+ #endif
195
+
196
+ /* Another thread-safe version of crypt_gensalt; the generated setting
197
+ string is in storage allocated by malloc, and should be deallocated
198
+ with free when it is no longer needed. */
199
+ extern char *crypt_gensalt_ra (const char *__prefix, unsigned long __count,
200
+ const char *__rbytes, int __nrbytes)
201
+ __THROW;
202
+
203
+ /* Checks whether the given setting is a supported method.
204
+
205
+ The return value is 0 if there is nothing wrong with this setting.
206
+ Otherwise, it is one of the following constants. */
207
+ extern int crypt_checksalt (const char *__setting);
208
+
209
+ /* Constants for checking the return value of the
210
+ crypt_checksalt function. */
211
+ #define CRYPT_SALT_OK 0
212
+ #define CRYPT_SALT_INVALID 1
213
+ #define CRYPT_SALT_METHOD_DISABLED 2 /* NOT implemented, yet. */
214
+ #define CRYPT_SALT_METHOD_LEGACY 3
215
+ #define CRYPT_SALT_TOO_CHEAP 4 /* NOT implemented, yet. */
216
+
217
+ /* Convenience function to get the prefix of the preferred hash method,
218
+ which is also used by the crypt_gensalt functions, if their given
219
+ prefix parameter is NULL.
220
+
221
+ The return value is string that equals the prefix of the preferred
222
+ hash method. Otherwise, it is NULL. */
223
+ extern const char *crypt_preferred_method (void);
224
+
225
+ /* These macros could be checked by portable users of crypt_gensalt*
226
+ functions to find out whether null pointers could be specified
227
+ as PREFIX and RBYTES arguments. */
228
+ #define CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX @DEFAULT_PREFIX_ENABLED@
229
+ #define CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY 1
230
+
231
+ /* These macros can be checked by portable users of libxcrypt
232
+ to find out whether the function is implemented. */
233
+ #define CRYPT_CHECKSALT_AVAILABLE 1
234
+ #define CRYPT_PREFERRED_METHOD_AVAILABLE 1
235
+
236
+ /* Version number split in single integers. */
237
+ #define XCRYPT_VERSION_MAJOR @XCRYPT_VERSION_MAJOR@
238
+ #define XCRYPT_VERSION_MINOR @XCRYPT_VERSION_MINOR@
239
+
240
+ /* Version number coded into an integer. */
241
+ #define XCRYPT_VERSION_NUM ((XCRYPT_VERSION_MAJOR << 16) | \
242
+ XCRYPT_VERSION_MINOR)
243
+
244
+ /* Version number as a string constant. */
245
+ #define XCRYPT_VERSION_STR "@XCRYPT_VERSION_STR@"
246
+
247
+ @END_DECLS@
248
+
249
+ #endif /* crypt.h */
@@ -0,0 +1,363 @@
1
+ /*
2
+ * FreeSec: libcrypt for NetBSD
3
+ *
4
+ * Copyright (c) 1994 David Burren
5
+ * All rights reserved.
6
+ *
7
+ * Adapted for FreeBSD-2.0 by Geoffrey M. Rehmet
8
+ * this file should now *only* export crypt(), in order to make
9
+ * binaries of libcrypt exportable from the USA
10
+ *
11
+ * Adapted for FreeBSD-4.0 by Mark R V Murray
12
+ * this file should now *only* export crypt_des(), in order to make
13
+ * a module that can be optionally included in libcrypt.
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions
17
+ * are met:
18
+ * 1. Redistributions of source code must retain the above copyright
19
+ * notice, this list of conditions and the following disclaimer.
20
+ * 2. Redistributions in binary form must reproduce the above copyright
21
+ * notice, this list of conditions and the following disclaimer in the
22
+ * documentation and/or other materials provided with the distribution.
23
+ * 3. Neither the name of the author nor the names of other contributors
24
+ * may be used to endorse or promote products derived from this software
25
+ * without specific prior written permission.
26
+ *
27
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
28
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
31
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37
+ * SUCH DAMAGE.
38
+ *
39
+ * This is an original implementation of the DES and the crypt(3) interfaces
40
+ * by David Burren <davidb@werj.com.au>.
41
+ */
42
+
43
+ /*
44
+ * This program can regenerate the tables in alg-des-tables.c.
45
+ * It is preserved as documentation, but it should no longer be
46
+ * necessary to run it.
47
+ */
48
+
49
+ #include "crypt-port.h"
50
+
51
+ #include <inttypes.h>
52
+ #include <stdio.h>
53
+
54
+ static const uint8_t IP[64] =
55
+ {
56
+ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
57
+ 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
58
+ 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
59
+ 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
60
+ };
61
+
62
+ static uint8_t inv_key_perm[64];
63
+ static const uint8_t key_perm[56] =
64
+ {
65
+ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
66
+ 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
67
+ 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
68
+ 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
69
+ };
70
+
71
+ static uint8_t inv_comp_perm[56];
72
+ static const uint8_t comp_perm[48] =
73
+ {
74
+ 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
75
+ 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
76
+ 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
77
+ 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
78
+ };
79
+
80
+ /*
81
+ * No E box is used, as it's replaced by some ANDs, shifts, and ORs.
82
+ */
83
+
84
+ static uint8_t u_sbox[8][64];
85
+ static const uint8_t sbox[8][64] =
86
+ {
87
+ {
88
+ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
89
+ 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
90
+ 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
91
+ 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
92
+ },
93
+ {
94
+ 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
95
+ 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
96
+ 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
97
+ 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
98
+ },
99
+ {
100
+ 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
101
+ 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
102
+ 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
103
+ 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
104
+ },
105
+ {
106
+ 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
107
+ 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
108
+ 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
109
+ 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
110
+ },
111
+ {
112
+ 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
113
+ 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
114
+ 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
115
+ 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
116
+ },
117
+ {
118
+ 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
119
+ 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
120
+ 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
121
+ 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
122
+ },
123
+ {
124
+ 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
125
+ 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
126
+ 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
127
+ 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
128
+ },
129
+ {
130
+ 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
131
+ 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
132
+ 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
133
+ 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
134
+ }
135
+ };
136
+
137
+ static uint8_t un_pbox[32];
138
+ static const uint8_t pbox[32] =
139
+ {
140
+ 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
141
+ 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
142
+ };
143
+
144
+ static const uint32_t *bits28, *bits24;
145
+ static uint8_t init_perm[64], final_perm[64];
146
+
147
+ static const uint32_t bits32[32] =
148
+ {
149
+ 0x80000000, 0x40000000, 0x20000000, 0x10000000,
150
+ 0x08000000, 0x04000000, 0x02000000, 0x01000000,
151
+ 0x00800000, 0x00400000, 0x00200000, 0x00100000,
152
+ 0x00080000, 0x00040000, 0x00020000, 0x00010000,
153
+ 0x00008000, 0x00004000, 0x00002000, 0x00001000,
154
+ 0x00000800, 0x00000400, 0x00000200, 0x00000100,
155
+ 0x00000080, 0x00000040, 0x00000020, 0x00000010,
156
+ 0x00000008, 0x00000004, 0x00000002, 0x00000001
157
+ };
158
+
159
+ static const uint8_t bits8[8] =
160
+ { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
161
+
162
+ static uint8_t m_sbox_[4][4096];
163
+ static uint32_t ip_maskl_[8][256], ip_maskr_[8][256];
164
+ static uint32_t fp_maskl_[8][256], fp_maskr_[8][256];
165
+ static uint32_t key_perm_maskl_[8][128], key_perm_maskr_[8][128];
166
+ static uint32_t comp_maskl_[8][128], comp_maskr_[8][128];
167
+ static uint32_t psbox_[4][256];
168
+
169
+ static void
170
+ des_init(void)
171
+ {
172
+ int i, j, b, k, inbit, obit;
173
+ uint32_t *p, *il, *ir, *fl, *fr;
174
+
175
+ bits24 = (bits28 = bits32 + 4) + 4;
176
+
177
+ /*
178
+ * Invert the S-boxes, reordering the input bits.
179
+ */
180
+ for (i = 0; i < 8; i++)
181
+ for (j = 0; j < 64; j++)
182
+ {
183
+ b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
184
+ u_sbox[i][j] = sbox[i][b];
185
+ }
186
+
187
+ /*
188
+ * Convert the inverted S-boxes into 4 arrays of 8 bits.
189
+ * Each will handle 12 bits of the S-box input.
190
+ */
191
+ for (b = 0; b < 4; b++)
192
+ for (i = 0; i < 64; i++)
193
+ for (j = 0; j < 64; j++)
194
+ m_sbox_[b][(i << 6) | j] =
195
+ (uint8_t)((u_sbox[(b << 1)][i] << 4) |
196
+ u_sbox[(b << 1) + 1][j]);
197
+
198
+ /*
199
+ * Set up the initial & final permutations into a useful form, and
200
+ * initialise the inverted key permutation.
201
+ */
202
+ for (i = 0; i < 64; i++)
203
+ {
204
+ final_perm[i] = (uint8_t)(IP[i] - 1);
205
+ init_perm[final_perm[i]] = (uint8_t)i;
206
+ inv_key_perm[i] = 255;
207
+ }
208
+
209
+ /*
210
+ * Invert the key permutation and initialise the inverted key
211
+ * compression permutation.
212
+ */
213
+ for (i = 0; i < 56; i++)
214
+ {
215
+ inv_key_perm[key_perm[i] - 1] = (uint8_t)i;
216
+ inv_comp_perm[i] = 255;
217
+ }
218
+
219
+ /*
220
+ * Invert the key compression permutation.
221
+ */
222
+ for (i = 0; i < 48; i++)
223
+ {
224
+ inv_comp_perm[comp_perm[i] - 1] = (uint8_t)i;
225
+ }
226
+
227
+ /*
228
+ * Set up the OR-mask arrays for the initial and final permutations,
229
+ * and for the key initial and compression permutations.
230
+ */
231
+ for (k = 0; k < 8; k++)
232
+ {
233
+ for (i = 0; i < 256; i++)
234
+ {
235
+ *(il = &ip_maskl_[k][i]) = 0L;
236
+ *(ir = &ip_maskr_[k][i]) = 0L;
237
+ *(fl = &fp_maskl_[k][i]) = 0L;
238
+ *(fr = &fp_maskr_[k][i]) = 0L;
239
+ for (j = 0; j < 8; j++)
240
+ {
241
+ inbit = 8 * k + j;
242
+ if (i & bits8[j])
243
+ {
244
+ if ((obit = init_perm[inbit]) < 32)
245
+ *il |= bits32[obit];
246
+ else
247
+ *ir |= bits32[obit-32];
248
+ if ((obit = final_perm[inbit]) < 32)
249
+ *fl |= bits32[obit];
250
+ else
251
+ *fr |= bits32[obit - 32];
252
+ }
253
+ }
254
+ }
255
+ for (i = 0; i < 128; i++)
256
+ {
257
+ *(il = &key_perm_maskl_[k][i]) = 0L;
258
+ *(ir = &key_perm_maskr_[k][i]) = 0L;
259
+ for (j = 0; j < 7; j++)
260
+ {
261
+ inbit = 8 * k + j;
262
+ if (i & bits8[j + 1])
263
+ {
264
+ if ((obit = inv_key_perm[inbit]) == 255)
265
+ continue;
266
+ if (obit < 28)
267
+ *il |= bits28[obit];
268
+ else
269
+ *ir |= bits28[obit - 28];
270
+ }
271
+ }
272
+ *(il = &comp_maskl_[k][i]) = 0L;
273
+ *(ir = &comp_maskr_[k][i]) = 0L;
274
+ for (j = 0; j < 7; j++)
275
+ {
276
+ inbit = 7 * k + j;
277
+ if (i & bits8[j + 1])
278
+ {
279
+ if ((obit=inv_comp_perm[inbit]) == 255)
280
+ continue;
281
+ if (obit < 24)
282
+ *il |= bits24[obit];
283
+ else
284
+ *ir |= bits24[obit - 24];
285
+ }
286
+ }
287
+ }
288
+ }
289
+
290
+ /*
291
+ * Invert the P-box permutation, and convert into OR-masks for
292
+ * handling the output of the S-box arrays setup above.
293
+ */
294
+ for (i = 0; i < 32; i++)
295
+ un_pbox[pbox[i] - 1] = (uint8_t)i;
296
+
297
+ for (b = 0; b < 4; b++)
298
+ for (i = 0; i < 256; i++)
299
+ {
300
+ *(p = &psbox_[b][i]) = 0L;
301
+ for (j = 0; j < 8; j++)
302
+ {
303
+ if (i & bits8[j])
304
+ *p |= bits32[un_pbox[8 * b + j]];
305
+ }
306
+ }
307
+ }
308
+
309
+ static void
310
+ write_table_u8(size_t m, size_t n, const uint8_t *tbl, const char *name)
311
+ {
312
+ printf("\nconst uint8_t %s[%zu][%zu] = {\n", name, m, n);
313
+ for (size_t i = 0; i < m; i++)
314
+ {
315
+ fputs(" {", stdout);
316
+ for (size_t j = 0; j < n; j++)
317
+ {
318
+ if (j % 12 == 0)
319
+ fputs("\n ", stdout);
320
+ printf(" 0x%02x,", (unsigned int)tbl[i*n + j]);
321
+ }
322
+ puts("\n },");
323
+ }
324
+ puts("};");
325
+ }
326
+
327
+ static void
328
+ write_table_u32(size_t m, size_t n, const uint32_t *tbl, const char *name)
329
+ {
330
+ printf("\nconst uint32_t %s[%zu][%zu] = {\n", name, m, n);
331
+ for (size_t i = 0; i < m; i++)
332
+ {
333
+ fputs(" {", stdout);
334
+ for (size_t j = 0; j < n; j++)
335
+ {
336
+ if (j % 6 == 0)
337
+ fputs("\n ", stdout);
338
+ printf(" 0x%08"PRIx32",", tbl[i*n + j]);
339
+ }
340
+ puts("\n },");
341
+ }
342
+ puts("};");
343
+ }
344
+
345
+ int
346
+ main(void)
347
+ {
348
+ des_init();
349
+
350
+ write_table_u8(4, 4096, &m_sbox_[0][0], "m_sbox");
351
+
352
+ write_table_u32(8, 256, &ip_maskl_[0][0], "ip_maskl");
353
+ write_table_u32(8, 256, &ip_maskr_[0][0], "ip_maskr");
354
+ write_table_u32(8, 256, &fp_maskl_[0][0], "fp_maskl");
355
+ write_table_u32(8, 256, &fp_maskr_[0][0], "fp_maskr");
356
+
357
+ write_table_u32(8, 128, &key_perm_maskl_[0][0], "key_perm_maskl");
358
+ write_table_u32(8, 128, &key_perm_maskr_[0][0], "key_perm_maskr");
359
+ write_table_u32(8, 128, &comp_maskl_[0][0], "comp_maskl");
360
+ write_table_u32(8, 128, &comp_maskr_[0][0], "comp_maskr");
361
+
362
+ write_table_u32(4, 256, &psbox_[0][0], "psbox");
363
+ }
@@ -0,0 +1,59 @@
1
+ # This file is read by expand-selected-hashes and gen-crypt-hashes-h.
2
+ # It lists, for each supported hash algorithm, the name to be used to
3
+ # enable or disable it at configure time, which is also part of the
4
+ # name used for the 'crypt_fn' and 'gensalt_fn' entry points to the
5
+ # relevant algorithm module; the prefix used to identify the algorithm
6
+ # in hash strings; the number of bytes of random data that
7
+ # crypt_gensalt should draw from the OS when its caller doesn't supply
8
+ # any; and a comma-separated list of flags.
9
+ #
10
+ # The current set of possible flags is: STRONG means the hash is still
11
+ # considered strong enough to use for newly hashed passwords; this is
12
+ # the set of hashes that will be enabled when the library is
13
+ # configured with --enable-hashes=strong. DEFAULT means that this
14
+ # hash may be used as the default for newly hashed passwords;
15
+ # when crypt_gensalt is called with a null pointer for its prefix
16
+ # argument, it will use the first hash in this file that was enabled
17
+ # and has a DEFAULT flag. Hashes that are not STRONG should never be
18
+ # marked DEFAULT. If you change the set of DEFAULT hashes you must also
19
+ # update test-gensalt.c to match.
20
+ #
21
+ # ALT, FREEBSD, GLIBC, NETBSD, OPENBSD, OSX, OWL, SOLARIS, and SUSE
22
+ # mean that the hash was historically supported by crypt() as provided
23
+ # by that operating system / C library. These are also recognized by
24
+ # --enable-hashes as sets of hashes that can be enabled.
25
+ #
26
+ # Fields are separated by whitespace. Lines beginning with # are
27
+ # ignored; # is not otherwise significant. Multiple flags are
28
+ # separated by commas. A field whose contents are a single colon (:)
29
+ # is actually understood as an empty string; colon is used for this
30
+ # purpose because it cannot be part of a hash prefix or a C identifier.
31
+ #
32
+ # Because the first DEFAULT entry that's enabled is used for new
33
+ # hashes when crypt_gensalt() is called with a null prefix, the list
34
+ # should be kept in decreasing order of cryptographic strength overall
35
+ # (this only *matters* for DEFAULT entries, but it's easier to keep
36
+ # the whole list sorted that way). Because of how crypt() checks
37
+ # prefixes, the hashes that use an empty prefix (bigcrypt and
38
+ # descrypt) must be last (conveniently, these are also the weakest
39
+ # supported hashes).
40
+ #
41
+ #name h_prefix nrbytes flags
42
+ yescrypt $y$ 16 STRONG,DEFAULT,ALT,DEBIAN,FEDORA
43
+ gost_yescrypt $gy$ 16 STRONG,ALT
44
+ sm3_yescrypt $sm3y$ 16 STRONG,EULER,KYLIN
45
+ scrypt $7$ 16 STRONG
46
+ bcrypt $2b$ 16 STRONG,DEFAULT,ALT,FREEBSD,NETBSD,OPENBSD,OWL,SOLARIS,SUSE
47
+ bcrypt_y $2y$ 16 STRONG,ALT,OWL,SUSE
48
+ bcrypt_a $2a$ 16 STRONG,ALT,FREEBSD,NETBSD,OPENBSD,OWL,SOLARIS,SUSE
49
+ bcrypt_x $2x$ 16 ALT,OWL,SUSE
50
+ sm3crypt $sm3$ 16 EULER,KYLIN
51
+ sha512crypt $6$ 15 STRONG,DEFAULT,GLIBC,FREEBSD,SOLARIS
52
+ sha256crypt $5$ 15 GLIBC,FREEBSD,SOLARIS
53
+ sha1crypt $sha1 20 NETBSD
54
+ sunmd5 $md5 8 SOLARIS
55
+ md5crypt $1$ 9 GLIBC,FREEBSD,NETBSD,OPENBSD,SOLARIS
56
+ nt $3$ 1 FREEBSD
57
+ bsdicrypt _ 3 FREEBSD,NETBSD,OPENBSD,OSX
58
+ bigcrypt : 2 :
59
+ descrypt : 2 GLIBC,FREEBSD,NETBSD,OPENBSD,SOLARIS,OSX