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,269 @@
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
+ * Adapted for libxcrypt by Zack Weinberg, 2017
16
+ * writable global data eliminated; type-punning eliminated;
17
+ * des_init() run at build time (see des-mktables.c);
18
+ * made into a libxcrypt algorithm module (see des-crypt.c);
19
+ * functionality required to support the legacy encrypt() and
20
+ * setkey() primitives re-exposed (see des-obsolete.c).
21
+ *
22
+ * Redistribution and use in source and binary forms, with or without
23
+ * modification, are permitted provided that the following conditions
24
+ * are met:
25
+ * 1. Redistributions of source code must retain the above copyright
26
+ * notice, this list of conditions and the following disclaimer.
27
+ * 2. Redistributions in binary form must reproduce the above copyright
28
+ * notice, this list of conditions and the following disclaimer in the
29
+ * documentation and/or other materials provided with the distribution.
30
+ * 3. Neither the name of the author nor the names of other contributors
31
+ * may be used to endorse or promote products derived from this software
32
+ * without specific prior written permission.
33
+ *
34
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
35
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
38
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
40
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
43
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
44
+ * SUCH DAMAGE.
45
+ *
46
+ * This is an original implementation of the DES and the crypt(3) interfaces
47
+ * by David Burren <davidb@werj.com.au>.
48
+ *
49
+ * An excellent reference on the underlying algorithm (and related
50
+ * algorithms) is:
51
+ *
52
+ * B. Schneier, Applied Cryptography: protocols, algorithms,
53
+ * and source code in C, John Wiley & Sons, 1994.
54
+ *
55
+ * Note that in that book's description of DES the lookups for the initial,
56
+ * pbox, and final permutations are inverted (this has been brought to the
57
+ * attention of the author). A list of errata for this book has been
58
+ * posted to the sci.crypt newsgroup by the author and is available for FTP.
59
+ */
60
+
61
+ #include "crypt-port.h"
62
+
63
+ #if INCLUDE_descrypt || INCLUDE_bigcrypt || INCLUDE_bsdicrypt
64
+
65
+ #include "alg-des.h"
66
+ #include "byteorder.h"
67
+
68
+ static const uint8_t key_shifts[16] =
69
+ {
70
+ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
71
+ };
72
+
73
+ void
74
+ des_set_key (struct des_ctx *restrict ctx,
75
+ const unsigned char key[MIN_SIZE(8)])
76
+ {
77
+ uint32_t rawkey0, rawkey1, k0, k1, t0, t1;
78
+ int shifts, round;
79
+
80
+ rawkey0 = be32_to_cpu (&key[0]);
81
+ rawkey1 = be32_to_cpu (&key[4]);
82
+
83
+ /* Do key permutation and split into two 28-bit subkeys. */
84
+ k0 = key_perm_maskl[0][(rawkey0 >> 25) & 0x7f]
85
+ | key_perm_maskl[1][(rawkey0 >> 17) & 0x7f]
86
+ | key_perm_maskl[2][(rawkey0 >> 9) & 0x7f]
87
+ | key_perm_maskl[3][(rawkey0 >> 1) & 0x7f]
88
+ | key_perm_maskl[4][(rawkey1 >> 25) & 0x7f]
89
+ | key_perm_maskl[5][(rawkey1 >> 17) & 0x7f]
90
+ | key_perm_maskl[6][(rawkey1 >> 9) & 0x7f]
91
+ | key_perm_maskl[7][(rawkey1 >> 1) & 0x7f];
92
+ k1 = key_perm_maskr[0][(rawkey0 >> 25) & 0x7f]
93
+ | key_perm_maskr[1][(rawkey0 >> 17) & 0x7f]
94
+ | key_perm_maskr[2][(rawkey0 >> 9) & 0x7f]
95
+ | key_perm_maskr[3][(rawkey0 >> 1) & 0x7f]
96
+ | key_perm_maskr[4][(rawkey1 >> 25) & 0x7f]
97
+ | key_perm_maskr[5][(rawkey1 >> 17) & 0x7f]
98
+ | key_perm_maskr[6][(rawkey1 >> 9) & 0x7f]
99
+ | key_perm_maskr[7][(rawkey1 >> 1) & 0x7f];
100
+
101
+ /* Rotate subkeys and do compression permutation. */
102
+ shifts = 0;
103
+ for (round = 0; round < 16; round++)
104
+ {
105
+ shifts += key_shifts[round];
106
+
107
+ t0 = (k0 << shifts) | (k0 >> (28 - shifts));
108
+ t1 = (k1 << shifts) | (k1 >> (28 - shifts));
109
+
110
+ ctx->keysl[round] =
111
+ comp_maskl[0][(t0 >> 21) & 0x7f]
112
+ | comp_maskl[1][(t0 >> 14) & 0x7f]
113
+ | comp_maskl[2][(t0 >> 7) & 0x7f]
114
+ | comp_maskl[3][(t0 >> 0) & 0x7f]
115
+ | comp_maskl[4][(t1 >> 21) & 0x7f]
116
+ | comp_maskl[5][(t1 >> 14) & 0x7f]
117
+ | comp_maskl[6][(t1 >> 7) & 0x7f]
118
+ | comp_maskl[7][(t1 >> 0) & 0x7f];
119
+
120
+ ctx->keysr[round] =
121
+ comp_maskr[0][(t0 >> 21) & 0x7f]
122
+ | comp_maskr[1][(t0 >> 14) & 0x7f]
123
+ | comp_maskr[2][(t0 >> 7) & 0x7f]
124
+ | comp_maskr[3][(t0 >> 0) & 0x7f]
125
+ | comp_maskr[4][(t1 >> 21) & 0x7f]
126
+ | comp_maskr[5][(t1 >> 14) & 0x7f]
127
+ | comp_maskr[6][(t1 >> 7) & 0x7f]
128
+ | comp_maskr[7][(t1 >> 0) & 0x7f];
129
+ }
130
+ }
131
+
132
+ void
133
+ des_set_salt (struct des_ctx *restrict ctx, uint32_t salt)
134
+ {
135
+ uint32_t obit, saltbit, saltbits;
136
+ int i;
137
+ saltbits = 0L;
138
+ saltbit = 1;
139
+ obit = 0x800000;
140
+ for (i = 0; i < 24; i++)
141
+ {
142
+ if (salt & saltbit)
143
+ saltbits |= obit;
144
+ saltbit <<= 1;
145
+ obit >>= 1;
146
+ }
147
+ ctx->saltbits = saltbits;
148
+ }
149
+
150
+ void
151
+ des_crypt_block (struct des_ctx *restrict ctx,
152
+ unsigned char *out, const unsigned char *in,
153
+ unsigned int count, bool decrypt)
154
+ {
155
+ uint32_t l_in, r_in, l_out, r_out;
156
+ uint32_t l, r, *kl, *kr, *kl1, *kr1;
157
+ uint32_t f, r48l, r48r;
158
+ uint32_t saltbits = ctx->saltbits;
159
+ int round, rk_step;
160
+
161
+ /* Zero encryptions/decryptions doesn't make sense. */
162
+ if (count == 0)
163
+ count = 1;
164
+
165
+ if (decrypt)
166
+ {
167
+ kl1 = ctx->keysl + 15;
168
+ kr1 = ctx->keysr + 15;
169
+ rk_step = -1;
170
+ }
171
+ else
172
+ {
173
+ kl1 = ctx->keysl;
174
+ kr1 = ctx->keysr;
175
+ rk_step = 1;
176
+ }
177
+
178
+ /* Read the input, which is notionally in "big-endian" format. */
179
+ l_in = be32_to_cpu (in);
180
+ r_in = be32_to_cpu (in + 4);
181
+
182
+ /* Do initial permutation. */
183
+ l = ip_maskl[0][(l_in >> 24) & 0xff]
184
+ | ip_maskl[1][(l_in >> 16) & 0xff]
185
+ | ip_maskl[2][(l_in >> 8) & 0xff]
186
+ | ip_maskl[3][(l_in >> 0) & 0xff]
187
+ | ip_maskl[4][(r_in >> 24) & 0xff]
188
+ | ip_maskl[5][(r_in >> 16) & 0xff]
189
+ | ip_maskl[6][(r_in >> 8) & 0xff]
190
+ | ip_maskl[7][(r_in >> 0) & 0xff];
191
+ r = ip_maskr[0][(l_in >> 24) & 0xff]
192
+ | ip_maskr[1][(l_in >> 16) & 0xff]
193
+ | ip_maskr[2][(l_in >> 8) & 0xff]
194
+ | ip_maskr[3][(l_in >> 0) & 0xff]
195
+ | ip_maskr[4][(r_in >> 24) & 0xff]
196
+ | ip_maskr[5][(r_in >> 16) & 0xff]
197
+ | ip_maskr[6][(r_in >> 8) & 0xff]
198
+ | ip_maskr[7][(r_in >> 0) & 0xff];
199
+
200
+ do
201
+ {
202
+ kl = kl1;
203
+ kr = kr1;
204
+ round = 16;
205
+ do
206
+ {
207
+ /* Expand R to 48 bits (simulate the E-box). */
208
+ r48l = ((r & 0x00000001) << 23)
209
+ | ((r & 0xf8000000) >> 9)
210
+ | ((r & 0x1f800000) >> 11)
211
+ | ((r & 0x01f80000) >> 13)
212
+ | ((r & 0x001f8000) >> 15);
213
+ r48r = ((r & 0x0001f800) << 7)
214
+ | ((r & 0x00001f80) << 5)
215
+ | ((r & 0x000001f8) << 3)
216
+ | ((r & 0x0000001f) << 1)
217
+ | ((r & 0x80000000) >> 31);
218
+
219
+ /* Apply salt and permuted round key. */
220
+ f = (r48l ^ r48r) & saltbits;
221
+ r48l ^= f ^ *kl;
222
+ r48r ^= f ^ *kr;
223
+ kl += rk_step;
224
+ kr += rk_step;
225
+
226
+ /* Do sbox lookups (which shrink it back to 32 bits)
227
+ and the pbox permutation at the same time. */
228
+ f = psbox[0][m_sbox[0][r48l >> 12]]
229
+ | psbox[1][m_sbox[1][r48l & 0xfff]]
230
+ | psbox[2][m_sbox[2][r48r >> 12]]
231
+ | psbox[3][m_sbox[3][r48r & 0xfff]];
232
+
233
+ /* Now that we've permuted things, complete f(). */
234
+ f ^= l;
235
+ l = r;
236
+ r = f;
237
+ }
238
+ while (--round);
239
+
240
+ r = l;
241
+ l = f;
242
+ }
243
+ while (--count);
244
+
245
+ /* Do final permutation (inverse of IP). */
246
+ l_out =
247
+ fp_maskl[0][(l >> 24) & 0xff]
248
+ | fp_maskl[1][(l >> 16) & 0xff]
249
+ | fp_maskl[2][(l >> 8) & 0xff]
250
+ | fp_maskl[3][(l >> 0) & 0xff]
251
+ | fp_maskl[4][(r >> 24) & 0xff]
252
+ | fp_maskl[5][(r >> 16) & 0xff]
253
+ | fp_maskl[6][(r >> 8) & 0xff]
254
+ | fp_maskl[7][(r >> 0) & 0xff];
255
+ r_out =
256
+ fp_maskr[0][(l >> 24) & 0xff]
257
+ | fp_maskr[1][(l >> 16) & 0xff]
258
+ | fp_maskr[2][(l >> 8) & 0xff]
259
+ | fp_maskr[3][(l >> 0) & 0xff]
260
+ | fp_maskr[4][(r >> 24) & 0xff]
261
+ | fp_maskr[5][(r >> 16) & 0xff]
262
+ | fp_maskr[6][(r >> 8) & 0xff]
263
+ | fp_maskr[7][(r >> 0) & 0xff];
264
+
265
+ cpu_to_be32 (out, l_out);
266
+ cpu_to_be32 (out + 4, r_out);
267
+ }
268
+
269
+ #endif
@@ -0,0 +1,74 @@
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
+ * Adapted for libxcrypt by Zack Weinberg, 2017
16
+ * see notes in des.c
17
+ *
18
+ * Redistribution and use in source and binary forms, with or without
19
+ * modification, are permitted provided that the following conditions
20
+ * are met:
21
+ * 1. Redistributions of source code must retain the above copyright
22
+ * notice, this list of conditions and the following disclaimer.
23
+ * 2. Redistributions in binary form must reproduce the above copyright
24
+ * notice, this list of conditions and the following disclaimer in the
25
+ * documentation and/or other materials provided with the distribution.
26
+ * 3. Neither the name of the author nor the names of other contributors
27
+ * may be used to endorse or promote products derived from this software
28
+ * without specific prior written permission.
29
+ *
30
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
31
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
34
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40
+ * SUCH DAMAGE.
41
+ *
42
+ * This is an original implementation of the DES and the crypt(3) interfaces
43
+ * by David Burren <davidb@werj.com.au>.
44
+ */
45
+
46
+ #ifndef _CRYPT_ALG_DES_H
47
+ #define _CRYPT_ALG_DES_H 1
48
+
49
+ /* des.c */
50
+
51
+ struct des_ctx
52
+ {
53
+ uint32_t keysl[16];
54
+ uint32_t keysr[16];
55
+ uint32_t saltbits;
56
+ };
57
+
58
+ extern void des_set_key (struct des_ctx *restrict ctx,
59
+ const unsigned char key[MIN_SIZE(8)]);
60
+ extern void des_set_salt (struct des_ctx *restrict ctx,
61
+ uint32_t salt);
62
+ extern void des_crypt_block (struct des_ctx *restrict ctx,
63
+ unsigned char *out, const unsigned char *in,
64
+ unsigned int count, bool decrypt);
65
+
66
+ /* des-tables.c (generated by des-mktables) */
67
+ extern const uint8_t m_sbox[4][4096];
68
+ extern const uint32_t ip_maskl[8][256], ip_maskr[8][256];
69
+ extern const uint32_t fp_maskl[8][256], fp_maskr[8][256];
70
+ extern const uint32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
71
+ extern const uint32_t comp_maskl[8][128], comp_maskr[8][128];
72
+ extern const uint32_t psbox[4][256];
73
+
74
+ #endif /* alg-des.h */
@@ -0,0 +1,313 @@
1
+ /*
2
+ * Copyright (c) 2013, Alexey Degtyarev <alexey@renatasystems.org>.
3
+ * All rights reserved.
4
+ *
5
+ * Iteration constants defined in standard.
6
+ *
7
+ * $Id$
8
+ */
9
+
10
+ static const uint512_u buffer0 = {{ 0x0ULL, 0x0ULL, 0x0ULL,
11
+ 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL }};
12
+
13
+ #ifndef __GOST3411_BIG_ENDIAN__
14
+ static const uint512_u buffer512 = {{ 0x0000000000000200ULL,
15
+ 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL }};
16
+ #else
17
+ static const uint512_u buffer512 = {{ 0x0002000000000000ULL,
18
+ 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL, 0x0ULL }};
19
+ #endif
20
+
21
+ #ifndef __GOST3411_BIG_ENDIAN__
22
+ static const uint512_u C[12] = {
23
+ {{
24
+ 0xdd806559f2a64507ULL,
25
+ 0x05767436cc744d23ULL,
26
+ 0xa2422a08a460d315ULL,
27
+ 0x4b7ce09192676901ULL,
28
+ 0x714eb88d7585c4fcULL,
29
+ 0x2f6a76432e45d016ULL,
30
+ 0xebcb2f81c0657c1fULL,
31
+ 0xb1085bda1ecadae9ULL
32
+ }},
33
+ {{
34
+ 0xe679047021b19bb7ULL,
35
+ 0x55dda21bd7cbcd56ULL,
36
+ 0x5cb561c2db0aa7caULL,
37
+ 0x9ab5176b12d69958ULL,
38
+ 0x61d55e0f16b50131ULL,
39
+ 0xf3feea720a232b98ULL,
40
+ 0x4fe39d460f70b5d7ULL,
41
+ 0x6fa3b58aa99d2f1aULL
42
+ }},
43
+ {{
44
+ 0x991e96f50aba0ab2ULL,
45
+ 0xc2b6f443867adb31ULL,
46
+ 0xc1c93a376062db09ULL,
47
+ 0xd3e20fe490359eb1ULL,
48
+ 0xf2ea7514b1297b7bULL,
49
+ 0x06f15e5f529c1f8bULL,
50
+ 0x0a39fc286a3d8435ULL,
51
+ 0xf574dcac2bce2fc7ULL
52
+ }},
53
+ {{
54
+ 0x220cbebc84e3d12eULL,
55
+ 0x3453eaa193e837f1ULL,
56
+ 0xd8b71333935203beULL,
57
+ 0xa9d72c82ed03d675ULL,
58
+ 0x9d721cad685e353fULL,
59
+ 0x488e857e335c3c7dULL,
60
+ 0xf948e1a05d71e4ddULL,
61
+ 0xef1fdfb3e81566d2ULL
62
+ }},
63
+ {{
64
+ 0x601758fd7c6cfe57ULL,
65
+ 0x7a56a27ea9ea63f5ULL,
66
+ 0xdfff00b723271a16ULL,
67
+ 0xbfcd1747253af5a3ULL,
68
+ 0x359e35d7800fffbdULL,
69
+ 0x7f151c1f1686104aULL,
70
+ 0x9a3f410c6ca92363ULL,
71
+ 0x4bea6bacad474799ULL
72
+ }},
73
+ {{
74
+ 0xfa68407a46647d6eULL,
75
+ 0xbf71c57236904f35ULL,
76
+ 0x0af21f66c2bec6b6ULL,
77
+ 0xcffaa6b71c9ab7b4ULL,
78
+ 0x187f9ab49af08ec6ULL,
79
+ 0x2d66c4f95142a46cULL,
80
+ 0x6fa4c33b7a3039c0ULL,
81
+ 0xae4faeae1d3ad3d9ULL
82
+ }},
83
+ {{
84
+ 0x8886564d3a14d493ULL,
85
+ 0x3517454ca23c4af3ULL,
86
+ 0x06476983284a0504ULL,
87
+ 0x0992abc52d822c37ULL,
88
+ 0xd3473e33197a93c9ULL,
89
+ 0x399ec6c7e6bf87c9ULL,
90
+ 0x51ac86febf240954ULL,
91
+ 0xf4c70e16eeaac5ecULL
92
+ }},
93
+ {{
94
+ 0xa47f0dd4bf02e71eULL,
95
+ 0x36acc2355951a8d9ULL,
96
+ 0x69d18d2bd1a5c42fULL,
97
+ 0xf4892bcb929b0690ULL,
98
+ 0x89b4443b4ddbc49aULL,
99
+ 0x4eb7f8719c36de1eULL,
100
+ 0x03e7aa020c6e4141ULL,
101
+ 0x9b1f5b424d93c9a7ULL
102
+ }},
103
+ {{
104
+ 0x7261445183235adbULL,
105
+ 0x0e38dc92cb1f2a60ULL,
106
+ 0x7b2b8a9aa6079c54ULL,
107
+ 0x800a440bdbb2ceb1ULL,
108
+ 0x3cd955b7e00d0984ULL,
109
+ 0x3a7d3a1b25894224ULL,
110
+ 0x944c9ad8ec165fdeULL,
111
+ 0x378f5a541631229bULL
112
+ }},
113
+ {{
114
+ 0x74b4c7fb98459cedULL,
115
+ 0x3698fad1153bb6c3ULL,
116
+ 0x7a1e6c303b7652f4ULL,
117
+ 0x9fe76702af69334bULL,
118
+ 0x1fffe18a1b336103ULL,
119
+ 0x8941e71cff8a78dbULL,
120
+ 0x382ae548b2e4f3f3ULL,
121
+ 0xabbedea680056f52ULL
122
+ }},
123
+ {{
124
+ 0x6bcaa4cd81f32d1bULL,
125
+ 0xdea2594ac06fd85dULL,
126
+ 0xefbacd1d7d476e98ULL,
127
+ 0x8a1d71efea48b9caULL,
128
+ 0x2001802114846679ULL,
129
+ 0xd8fa6bbbebab0761ULL,
130
+ 0x3002c6cd635afe94ULL,
131
+ 0x7bcd9ed0efc889fbULL
132
+ }},
133
+ {{
134
+ 0x48bc924af11bd720ULL,
135
+ 0xfaf417d5d9b21b99ULL,
136
+ 0xe71da4aa88e12852ULL,
137
+ 0x5d80ef9d1891cc86ULL,
138
+ 0xf82012d430219f9bULL,
139
+ 0xcda43c32bcdf1d77ULL,
140
+ 0xd21380b00449b17aULL,
141
+ 0x378ee767f11631baULL
142
+ }}
143
+ };
144
+ #else
145
+ static const uint512_u C[12] = {
146
+ {{
147
+ 0x0745a6f2596580ddULL,
148
+ 0x234d74cc36747605ULL,
149
+ 0x15d360a4082a42a2ULL,
150
+ 0x0169679291e07c4bULL,
151
+ 0xfcc485758db84e71ULL,
152
+ 0x16d0452e43766a2fULL,
153
+ 0x1f7c65c0812fcbebULL,
154
+ 0xe9daca1eda5b08b1ULL
155
+ }},
156
+ {{
157
+ 0xb79bb121700479e6ULL,
158
+ 0x56cdcbd71ba2dd55ULL,
159
+ 0xcaa70adbc261b55cULL,
160
+ 0x5899d6126b17b59aULL,
161
+ 0x3101b5160f5ed561ULL,
162
+ 0x982b230a72eafef3ULL,
163
+ 0xd7b5700f469de34fULL,
164
+ 0x1a2f9da98ab5a36fULL
165
+ }},
166
+ {{
167
+ 0xb20aba0af5961e99ULL,
168
+ 0x31db7a8643f4b6c2ULL,
169
+ 0x09db6260373ac9c1ULL,
170
+ 0xb19e3590e40fe2d3ULL,
171
+ 0x7b7b29b11475eaf2ULL,
172
+ 0x8b1f9c525f5ef106ULL,
173
+ 0x35843d6a28fc390aULL,
174
+ 0xc72fce2bacdc74f5ULL
175
+ }},
176
+ {{
177
+ 0x2ed1e384bcbe0c22ULL,
178
+ 0xf137e893a1ea5334ULL,
179
+ 0xbe0352933313b7d8ULL,
180
+ 0x75d603ed822cd7a9ULL,
181
+ 0x3f355e68ad1c729dULL,
182
+ 0x7d3c5c337e858e48ULL,
183
+ 0xdde4715da0e148f9ULL,
184
+ 0xd26615e8b3df1fefULL
185
+ }},
186
+ {{
187
+ 0x57fe6c7cfd581760ULL,
188
+ 0xf563eaa97ea2567aULL,
189
+ 0x161a2723b700ffdfULL,
190
+ 0xa3f53a254717cdbfULL,
191
+ 0xbdff0f80d7359e35ULL,
192
+ 0x4a1086161f1c157fULL,
193
+ 0x6323a96c0c413f9aULL,
194
+ 0x994747adac6bea4bULL
195
+ }},
196
+ {{
197
+ 0x6e7d64467a4068faULL,
198
+ 0x354f903672c571bfULL,
199
+ 0xb6c6bec2661ff20aULL,
200
+ 0xb4b79a1cb7a6facfULL,
201
+ 0xc68ef09ab49a7f18ULL,
202
+ 0x6ca44251f9c4662dULL,
203
+ 0xc039307a3bc3a46fULL,
204
+ 0xd9d33a1daeae4faeULL
205
+ }},
206
+ {{
207
+ 0x93d4143a4d568688ULL,
208
+ 0xf34a3ca24c451735ULL,
209
+ 0x04054a2883694706ULL,
210
+ 0x372c822dc5ab9209ULL,
211
+ 0xc9937a19333e47d3ULL,
212
+ 0xc987bfe6c7c69e39ULL,
213
+ 0x540924bffe86ac51ULL,
214
+ 0xecc5aaee160ec7f4ULL
215
+ }},
216
+ {{
217
+ 0x1ee702bfd40d7fa4ULL,
218
+ 0xd9a8515935c2ac36ULL,
219
+ 0x2fc4a5d12b8dd169ULL,
220
+ 0x90069b92cb2b89f4ULL,
221
+ 0x9ac4db4d3b44b489ULL,
222
+ 0x1ede369c71f8b74eULL,
223
+ 0x41416e0c02aae703ULL,
224
+ 0xa7c9934d425b1f9bULL
225
+ }},
226
+ {{
227
+ 0xdb5a238351446172ULL,
228
+ 0x602a1fcb92dc380eULL,
229
+ 0x549c07a69a8a2b7bULL,
230
+ 0xb1ceb2db0b440a80ULL,
231
+ 0x84090de0b755d93cULL,
232
+ 0x244289251b3a7d3aULL,
233
+ 0xde5f16ecd89a4c94ULL,
234
+ 0x9b223116545a8f37ULL
235
+ }},
236
+ {{
237
+ 0xed9c4598fbc7b474ULL,
238
+ 0xc3b63b15d1fa9836ULL,
239
+ 0xf452763b306c1e7aULL,
240
+ 0x4b3369af0267e79fULL,
241
+ 0x0361331b8ae1ff1fULL,
242
+ 0xdb788aff1ce74189ULL,
243
+ 0xf3f3e4b248e52a38ULL,
244
+ 0x526f0580a6debeabULL
245
+ }},
246
+ {{
247
+ 0x1b2df381cda4ca6bULL,
248
+ 0x5dd86fc04a59a2deULL,
249
+ 0x986e477d1dcdbaefULL,
250
+ 0xcab948eaef711d8aULL,
251
+ 0x7966841421800120ULL,
252
+ 0x6107abebbb6bfad8ULL,
253
+ 0x94fe5a63cdc60230ULL,
254
+ 0xfb89c8efd09ecd7bULL
255
+ }},
256
+ {{
257
+ 0x20d71bf14a92bc48ULL,
258
+ 0x991bb2d9d517f4faULL,
259
+ 0x5228e188aaa41de7ULL,
260
+ 0x86cc91189def805dULL,
261
+ 0x9b9f2130d41220f8ULL,
262
+ 0x771ddfbc323ca4cdULL,
263
+ 0x7ab14904b08013d2ULL,
264
+ 0xba3116f167e78e37ULL
265
+ }}
266
+ };
267
+ #endif
268
+
269
+ static const unsigned char Tau[64] = {
270
+ 0, 8, 16, 24, 32, 40, 48, 56,
271
+ 1, 9, 17, 25, 33, 41, 49, 57,
272
+ 2, 10, 18, 26, 34, 42, 50, 58,
273
+ 3, 11, 19, 27, 35, 43, 51, 59,
274
+ 4, 12, 20, 28, 36, 44, 52, 60,
275
+ 5, 13, 21, 29, 37, 45, 53, 61,
276
+ 6, 14, 22, 30, 38, 46, 54, 62,
277
+ 7, 15, 23, 31, 39, 47, 55, 63
278
+ };
279
+
280
+ static const unsigned char Pi[256] = {
281
+ 252, 238, 221, 17, 207, 110, 49, 22,
282
+ 251, 196, 250, 218, 35, 197, 4, 77,
283
+ 233, 119, 240, 219, 147, 46, 153, 186,
284
+ 23, 54, 241, 187, 20, 205, 95, 193,
285
+ 249, 24, 101, 90, 226, 92, 239, 33,
286
+ 129, 28, 60, 66, 139, 1, 142, 79,
287
+ 5, 132, 2, 174, 227, 106, 143, 160,
288
+ 6, 11, 237, 152, 127, 212, 211, 31,
289
+ 235, 52, 44, 81, 234, 200, 72, 171,
290
+ 242, 42, 104, 162, 253, 58, 206, 204,
291
+ 181, 112, 14, 86, 8, 12, 118, 18,
292
+ 191, 114, 19, 71, 156, 183, 93, 135,
293
+ 21, 161, 150, 41, 16, 123, 154, 199,
294
+ 243, 145, 120, 111, 157, 158, 178, 177,
295
+ 50, 117, 25, 61, 255, 53, 138, 126,
296
+ 109, 84, 198, 128, 195, 189, 13, 87,
297
+ 223, 245, 36, 169, 62, 168, 67, 201,
298
+ 215, 121, 214, 246, 124, 34, 185, 3,
299
+ 224, 15, 236, 222, 122, 148, 176, 188,
300
+ 220, 232, 40, 80, 78, 51, 10, 74,
301
+ 167, 151, 96, 115, 30, 0, 98, 68,
302
+ 26, 184, 56, 130, 100, 159, 38, 65,
303
+ 173, 69, 70, 146, 39, 94, 85, 47,
304
+ 140, 163, 165, 125, 105, 213, 149, 59,
305
+ 7, 88, 179, 64, 134, 172, 29, 247,
306
+ 48, 55, 107, 228, 136, 217, 231, 137,
307
+ 225, 27, 131, 73, 76, 63, 248, 254,
308
+ 141, 83, 170, 144, 202, 216, 133, 97,
309
+ 32, 113, 103, 164, 45, 43, 9, 91,
310
+ 203, 155, 37, 208, 190, 229, 108, 82,
311
+ 89, 166, 116, 210, 230, 244, 180, 192,
312
+ 209, 102, 175, 194, 57, 75, 99, 182
313
+ };