]> gitweb.factorcode.org Git - factor.git/blob - basis/checksums/fnv1/fnv1.factor
factor: trim using lists
[factor.git] / basis / checksums / fnv1 / fnv1.factor
1 ! Copyright (C) 2009 Alaric Snell-Pym
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: checksums kernel math sequences ;
4 IN: checksums.fnv1
5
6 SINGLETON: fnv1-32
7 SINGLETON: fnv1a-32
8 SINGLETON: fnv1-64
9 SINGLETON: fnv1a-64
10 SINGLETON: fnv1-128
11 SINGLETON: fnv1a-128
12 SINGLETON: fnv1-256
13 SINGLETON: fnv1a-256
14 SINGLETON: fnv1-512
15 SINGLETON: fnv1a-512
16 SINGLETON: fnv1-1024
17 SINGLETON: fnv1a-1024
18
19 CONSTANT: fnv1-32-prime 16777619
20 CONSTANT: fnv1-64-prime 1099511628211
21 CONSTANT: fnv1-128-prime 309485009821345068724781371
22 CONSTANT: fnv1-256-prime 374144419156711147060143317175368453031918731002211
23 CONSTANT: fnv1-512-prime 35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759
24 CONSTANT: fnv1-1024-prime 5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573
25
26 CONSTANT: fnv1-32-mod 0xffffffff
27 CONSTANT: fnv1-64-mod 0xffffffffffffffff
28 CONSTANT: fnv1-128-mod 0xffffffffffffffffffffffffffffffff
29 CONSTANT: fnv1-256-mod 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
30 CONSTANT: fnv1-512-mod 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
31 CONSTANT: fnv1-1024-mod 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
32
33 CONSTANT: fnv1-32-basis 0x811c9dc5
34 CONSTANT: fnv1-64-basis 0xcbf29ce484222325
35 CONSTANT: fnv1-128-basis 0x6c62272e07bb014262b821756295c58d
36 CONSTANT: fnv1-256-basis 0xdd268dbcaac550362d98c384c4e576ccc8b1536847b6bbb31023b4c8caee0535
37 CONSTANT: fnv1-512-basis 0xb86db0b1171f4416dca1e50f309990acac87d059c90000000000000000000d21e948f68a34c192f62ea79bc942dbe7ce182036415f56e34bac982aac4afe9fd9
38 CONSTANT: fnv1-1024-basis 0x5f7a76758ecc4d32e56d5a591028b74b29fc4223fdada16c3bf34eda3674da9a21d9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004c6d7eb6e73802734510a555f256cc005ae556bde8cc9c6a93b21aff4b16c71ee90b3
39
40 M: fnv1-32 checksum-bytes
41     drop
42     fnv1-32-basis swap
43     [ swap fnv1-32-prime * bitxor fnv1-32-mod bitand ] each ;
44
45 M: fnv1a-32 checksum-bytes
46     drop
47     fnv1-32-basis swap
48     [ bitxor fnv1-32-prime * fnv1-32-mod bitand ] each ;
49
50
51 M: fnv1-64 checksum-bytes
52     drop
53     fnv1-64-basis swap
54     [ swap fnv1-64-prime * bitxor fnv1-64-mod bitand ] each ;
55
56 M: fnv1a-64 checksum-bytes
57     drop
58     fnv1-64-basis swap
59     [ bitxor fnv1-64-prime * fnv1-64-mod bitand ] each ;
60
61
62 M: fnv1-128 checksum-bytes
63     drop
64     fnv1-128-basis swap
65     [ swap fnv1-128-prime * bitxor fnv1-128-mod bitand ] each ;
66
67 M: fnv1a-128 checksum-bytes
68     drop
69     fnv1-128-basis swap
70     [ bitxor fnv1-128-prime * fnv1-128-mod bitand ] each ;
71
72
73 M: fnv1-256 checksum-bytes
74     drop
75     fnv1-256-basis swap
76     [ swap fnv1-256-prime * bitxor fnv1-256-mod bitand ] each ;
77
78 M: fnv1a-256 checksum-bytes
79     drop
80     fnv1-256-basis swap
81     [ bitxor fnv1-256-prime * fnv1-256-mod bitand ] each ;
82
83
84 M: fnv1-512 checksum-bytes
85     drop
86     fnv1-512-basis swap
87     [ swap fnv1-512-prime * bitxor fnv1-512-mod bitand ] each ;
88
89 M: fnv1a-512 checksum-bytes
90     drop
91     fnv1-512-basis swap
92     [ bitxor fnv1-512-prime * fnv1-512-mod bitand ] each ;
93
94
95 M: fnv1-1024 checksum-bytes
96     drop
97     fnv1-1024-basis swap
98     [ swap fnv1-1024-prime * bitxor fnv1-1024-mod bitand ] each ;
99
100 M: fnv1a-1024 checksum-bytes
101     drop
102     fnv1-1024-basis swap
103     [ bitxor fnv1-1024-prime * fnv1-1024-mod bitand ] each ;
104
105 INSTANCE: fnv1-32 checksum
106 INSTANCE: fnv1a-32 checksum
107 INSTANCE: fnv1-64 checksum
108 INSTANCE: fnv1a-64 checksum
109 INSTANCE: fnv1-128 checksum
110 INSTANCE: fnv1a-128 checksum
111 INSTANCE: fnv1-256 checksum
112 INSTANCE: fnv1a-256 checksum
113 INSTANCE: fnv1-512 checksum
114 INSTANCE: fnv1a-512 checksum
115 INSTANCE: fnv1-1024 checksum
116 INSTANCE: fnv1a-1024 checksum