crc 0.4.1 → 0.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e8e6fc81bbcef03f0e899ac1938b7535ddaa344a
4
- data.tar.gz: 254fc51f632a763e49fd0d9483cb28c8265fbda3
2
+ SHA256:
3
+ metadata.gz: 0b6f6d28a243bad0ffb9e82e9aee4209345b284cd82433783da10a2ebe60c049
4
+ data.tar.gz: e7c0aea67d734fc21567428df2d46047e2d8484d1f6147dbafcd4f9d280d8466
5
5
  SHA512:
6
- metadata.gz: c2a19eac87f476a4a3fec5c1646d465d689a36ce5e04782a978d4acd8823823c130e4c26deaa19ac1d78881151c28641f2456f4a41b6c48d8ba21290af0a79e5
7
- data.tar.gz: ea0a58a84d5dce2c66e2f3ca9a3f2374d249034c64b54f138aa1bc451ece1a1e31b3d7c69f62f1b5f22227bea2801b27b1a32ed51e7af62193892626eed45097
6
+ metadata.gz: '02249a8be40ac1ec6590841b217aec8f4cc0f5a5fddd1f563e573820bc50094320aed04b03ebcdcf93e0c4b85d19da8fe0973eaa6f3c586da3702a69ab6f7c08'
7
+ data.tar.gz: 9b5885a2b02026dc254953ce93024b5a8ac69e576698c6f4a8a42b0b93062bb5011d7c6478498c3bee6635b8a185b795f559591970f122ca81c6e68d7d32b2fb
@@ -2,6 +2,14 @@ This document is written in Japanese.
2
2
 
3
3
  # crc for ruby の更新履歴
4
4
 
5
+ ## crc-0.4.2 (令和2年9月20日 日曜日)
6
+
7
+ * "CRC Module" は "CRC Model" とするべきなので修正
8
+ * 初期値の間違っていた CRC モデルがあったため修正
9
+ * "calcurator" は "calculator" の誤植なので修正 (thanks @stbnrivas [#2](https://github.com/dearblue/ruby-crc/pull/2))
10
+ * 間違ったリンクの修正 (thanks @simi [#1](https://github.com/dearblue/ruby-crc/pull/1))
11
+
12
+
5
13
  ## crc-0.4.1 (平成29年4月1日 土曜日)
6
14
 
7
15
  * rbcrc -lvv の表示に、ビット反転多項式、相反多項式、初期内部状態、ビット反転魔法数を追加
@@ -0,0 +1,281 @@
1
+
2
+ # crc - CRC calcurator for ruby
3
+
4
+ これは Ruby 向けの汎用 CRC (巡回冗長検査; Cyclic Redundancy Check) 算出器です。
5
+
6
+ “Slicing by 8” アルゴリズムを基にした“バイトオーダーフリーの Slicing by 16 アルゴリズム” を 100% Ruby で記述しています。
7
+
8
+ CRC モデルとして CRC-32、CRC-32C、CRC-64-XZ、CRC-16、CRC-8-MAXIM、CRC-5-USB ほか多数が最初から組み込まれています。
9
+
10
+ 利用者は、1〜64のビット幅、任意の多項式、および入出力のビット反射の有無に関してカスタマイズが可能です。
11
+
12
+ このライブラリは FreeBSD 10.3R amd64 上の zlib の `crc32()` よりも 85倍以上遅く、liblzma の `crc32()` よりも 120倍以上低速です。
13
+
14
+ さらに速度が必要な場合は、[crc-turbo](https://rubygems.org/gems/crc-turbo) と併用してください。
15
+
16
+
17
+ ## API Guide
18
+
19
+ この例は CRC-32 モデル (`CRC::CRC32` クラス) を使用しています。
20
+ 他の CRC モデルについては脳内変換して下さい。
21
+
22
+ ### 即時的算出
23
+
24
+ * `CRC.crc32(seq, init = CRC::CRC32.initial_crc) => crc-32 integer` (likely as `Zlib.crc32`)
25
+ * `CRC.crc32.crc(seq, init = CRC::CRC32.initial_crc) => crc-32 integer` (likely as `Zlib.crc32`)
26
+ * `CRC.crc32.digest(seq, init = CRC::CRC32.initial_crc) => crc-32 digest` (likely as `Digest::XXXX.digest`)
27
+ * `CRC.crc32.hexdigest(seq, init = CRC::CRC32.initial_crc) -> crc-32 hex-digest` (likely as `Digest::XXXX.hexdigest`)
28
+ * `CRC.crc32[seq, init = CRC::CRC32.initial_crc, current_length = 0] -> crc-32 calcurator`
29
+
30
+ ### 段階的算出 (ストリーミング)
31
+
32
+ * `CRC.crc32.new(init = 0, current_length = 0) => crc-32 calcurator`
33
+ * `CRC::CRC32#update(seq) => self` (likely as `Digest::XXXX.update`)
34
+ * `CRC::CRC32#finish => crc-32 integer` (likely as `Digest::XXXX.finish`)
35
+ * `CRC::CRC32#crc => crc-32 integer` (same as `CRC::CRC32#finish`)
36
+ * `CRC::CRC32#digest => crc-32 digest` (likely as `Digest::XXXX.digest`)
37
+ * `CRC::CRC32#hexdigest => crc-32 hex-digest` (likely as `Digest::XXXX.hexdigest`)
38
+
39
+ #### 例
40
+
41
+ ``` ruby:ruby
42
+ x = CRC.crc32.new # => #<CRC::CRC32:00000000>
43
+ x.update "123" # => #<CRC::CRC32:884863D2>
44
+ x.update "456789" # => #<CRC::CRC32:CBF43926>
45
+ x.crc # => 3421780262
46
+ x.digest # => "\xCB\xF49&"
47
+ x.hexdigest # => "CBF43926"
48
+ ```
49
+
50
+ ### CRC 値の結合
51
+
52
+ - `CRC.combine(crc1, crc2, len2) => combined crc integer` (likely as `Zlib.crc32_comibne`)
53
+ - `CRC#+(right_crc) => combined crc calcurator`
54
+
55
+ `CRC.combine` は Mark Adler 氏による crccomb.c (<https://stackoverflow.com/questions/29915764/generic-crc-8-16-32-64-combine-implementation#29928573>) をそっくり~~パクった~~移植したものです。
56
+
57
+ #### 例1
58
+
59
+ ``` ruby:ruby
60
+ CRC.crc32.combine(CRC.crc32("123"), CRC.crc32("456789"), 6) # => 3421780262
61
+ ```
62
+
63
+ #### 例2
64
+
65
+ ``` ruby:ruby
66
+ CRC.crc32["123"] + CRC.crc32["456"] + CRC.crc32["789"] # => #<CRC::CRC32:CBF43926>
67
+ ```
68
+
69
+ ### 利用者定義 CRC モデルの生成
70
+
71
+ * `CRC.new(bitsize, poly, initial_crc = 0, refin = true, refout = true, xor_output = ~0) => new crc model class`
72
+
73
+ #### 例
74
+
75
+ ``` ruby:ruby
76
+ MyCRC32 = CRC.new(32, 0x04C11DB7)
77
+ MyCRC32.class # => Class
78
+ MyCRC32.hexdigest("123456789") # => "CBF43926"
79
+ MyCRC32["123456789"] # => #<MyCRC32:CBF43926>
80
+ ```
81
+
82
+ ### 逆進 CRC 値の算出
83
+
84
+ - `CRC::XXX.acrc(pre, post = nil, want_crc = 0) => arc-crc byte string`
85
+
86
+ #### 例
87
+
88
+ ``` ruby:ruby
89
+ a = "12"
90
+ c = "789"
91
+ wantcrc = CRC.crc32("123456789")
92
+ b = CRC.crc32.acrc(a, c, wantcrc) # => "3456"
93
+ CRC.crc32[a + b + c] # => #<CRC::CRC32:CBF43926>
94
+ ```
95
+
96
+ See CRC::Calcurate.acrc or below for more detail.
97
+
98
+
99
+ ## 組み込み CRC モデル
100
+
101
+ ```
102
+ $ rbcrc -lq
103
+ ```
104
+
105
+ CRC-1, CRC-3-ROHC, CRC-4-INTERLAKEN, CRC-4-ITU, CRC-5-EPC, CRC-5-ITU, CRC-5-USB, CRC-6-CDMA2000-A, CRC-6-CDMA2000-B, CRC-6-DARC, CRC-6-ITU, CRC-7, CRC-7-ROHC, CRC-7-UMTS, CRC-8-CCITT, CRC-8-MAXIM, CRC-8-DARC, CRC-8-SAE, CRC-8-WCDMA, CRC-8-CDMA2000, CRC-8-DVB-S2, CRC-8-EBU, CRC-8-I-CODE, CRC-8-ITU, CRC-8-LTE, CRC-8-ROHC, CRC-10, CRC-10-CDMA2000, CRC-11, CRC-11-UMTS, CRC-12-CDMA2000, CRC-12-DECT, CRC-12-UMTS, CRC-13-BBC, CRC-14-DARC, CRC-15, CRC-15-MPT1327, CRC-16, CRC-16-AUG-CCITT, CRC-16-CDMA2000, CRC-16-DECT-R, CRC-16-DECT-X, CRC-16-T10-DIF, CRC-16-DNP, CRC-16-BUYPASS, CRC-16-CCITT-FALSE, CRC-16-DDS-110, CRC-16-EN-13757, CRC-16-GENIBUS, CRC-16-LJ1200, CRC-16-MAXIM, CRC-16-MCRF4XX, CRC-16-RIELLO, CRC-16-TELEDISK, CRC-16-TMS37157, CRC-16-USB, CRC-16-A, CRC-16-KERMIT, CRC-16-MODBUS, CRC-16-X-25, CRC-16-XMODEM, CRC-24-Radix-64, CRC-24-OPENPGP, CRC-24-BLE, CRC-24-FLEXRAY-A, CRC-24-FLEXRAY-B, CRC-24-INTERLAKEN, CRC-24-LTE-A, CRC-24-LTE-B, CRC-30-CDMA, CRC-31-PHILIPS, CRC-32, CRC-32-BZIP2, CRC-32C, CRC-32D, CRC-32-MPEG-2, CRC-32-POSIX, CRC-32Q, CRC-32-JAMCRC, CRC-32-XFER, CRC-40-GSM, CRC-64-XZ, CRC-64-JONES, CRC-64-ECMA, CRC-64-WE, CRC-64-ISO
106
+
107
+
108
+ ## 環境変数
109
+
110
+ ### `RUBY_CRC_NOFAST`
111
+
112
+ 内部処理の実装を変更します。
113
+
114
+ - `RUBY_CRC_NOFAST=0`: 可能であれば "crc-turbo" を使います。ライブラリの読み込みが出来なければ、`RUBY_CRC_NOFAST=1` と同じ挙動になります。
115
+ - `RUBY_CRC_NOFAST=1`: Ruby で実装された“Slicing by 16”アルゴリズムの仕様を強制します。"crc-turbo" は使われません。
116
+ - `RUBY_CRC_NOFAST=2`: Dilip V. Sarwate 氏によるテーブルアルゴリズムに切り替えます。52% ほどに低速となります (CRC-32 の場合)。
117
+ - `RUBY_CRC_NOFAST=3`: ビット単位の計算アルゴリズムに切り替えます。`RUBY_CRC_NOFAST=1` と比較して 7% ほどに低速となります (CRC-32 の場合)。
118
+
119
+
120
+ ## Source code generator for the specific CRC calcurator (from crc-0.3.1)
121
+
122
+ C・Ruby・javascript 向けの特化した CRC 算出器のソースコード生成機能があります。
123
+
124
+ アルゴリズムは Ruby および javascript の場合は“Slicing by 16”に限定されます。
125
+
126
+ Cの場合は、bit-by-bit, bit-by-bit-fast, halfbyte-table, standard-table, slicing-by-4, slicing-by-8, and slicing-by-16 を選択できます。
127
+
128
+ ```
129
+ $ rbcrc --help
130
+ usage: rbcrc [options] output-filename...
131
+ -m crcname choose included crc name in library (``-l'' to print list)
132
+ -n crcname declare function name or class name [DEFAULT is filename]
133
+ -s bitsize declare crc bit size [REQUIRED for customized crc]
134
+ -p polynom declare crc polynomial [REQUIRED for customized crc]
135
+ -c initcrc declare initial crc (not internal state) [DEFAULT: 0]
136
+ -S initstate declare initial state (internal state) [DEFAULT: unset]
137
+ -x xormask declare xor bit mask for when output [DEFAULT: ~0]
138
+ -i reflect input [DEFAULT]
139
+ -I normal input (not reflect)
140
+ -o reflect output [DEFAULT]
141
+ -O normal output (not reflect)
142
+ -a algorithm switch algorithm (see below) (C file type only)
143
+
144
+ -l print crc names
145
+ -f force overwrite
146
+ -v increment verbosery level
147
+ -q quiet mode (reset verbosery level to zero)
148
+
149
+ About LICENSE for generated source code:
150
+ Generated code is under Creative Commons License Zero (CC0 / Public Domain).
151
+ See https://creativecommons.org/publicdomain/zero/1.0/
152
+
153
+ Algorithms (C file type only):
154
+ bit-by-bit, bit-by-bit-fast, halfbyte-table, standard-table,
155
+ slicing-by-4, slicing-by-8, slicing-by-16, slicing-by-{2..999}
156
+
157
+ Support export file types:
158
+ * .c for C (support C89, but required ``stdint.h'')
159
+ * .js for javascript (required ECMAScript 6th edition)
160
+ * .rb for ruby (for ruby-2.1+, jruby, and rubinius)
161
+ (executable for ruby-1.8, ruby-1.9 and ruby-2.0)
162
+ (executable for mruby and limitation bitsize by fixnum)
163
+
164
+ examples:
165
+ * create crc-32 calcurator to c source (and header file)
166
+ $ rbcrc crc32.c
167
+
168
+ * create crc-32c calcurator to ruby source
169
+ $ rbcrc crc32c.rb
170
+
171
+ * create crc-30-cdma calcurator to javascript source
172
+ $ rbcrc crc30cdma.js
173
+
174
+ * create crc-32 calcurator to ``crc.c'', ``crc.rb'' and ``crc.js''
175
+ $ rbcrc -mcrc32 crc.c crc.rb crc.js
176
+
177
+ * create customized crc calcurator (as mycrc function) to ``mycrc.c''
178
+ $ rbcrc -s15 -p0x6789 -io -x~0 mycrc.c
179
+
180
+ * create customized crc calcurator (as MyCRC class) to ``mycrc_1.rb''
181
+ $ rbcrc -s39 -p0x987654321 -IO -x1 -nMyCRC mycrc_1.rb
182
+ ```
183
+
184
+ - - - -
185
+
186
+ また、このコマンドには各 CRC 仕様を YAML 形式で出力する機能もあります。
187
+
188
+ ``` text
189
+ $ rbcrc -lvv
190
+ ...snip...
191
+ "CRC-32":
192
+ bitsize: 32
193
+ polynomial: 0x04C11DB7 # 0xEDB88320 (bit reflected)
194
+ reversed reciprocal: 0x82608EDB # 0xDB710641 (bit reflected)
195
+ reflect input: true
196
+ reflect output: true
197
+ initial crc: 0x00000000 # 0xFFFFFFFF (initial state)
198
+ xor output: 0xFFFFFFFF
199
+ magic number: 0x2144DF1C # 0xDEBB20E3 (internal state)
200
+ another names:
201
+ - "CRC-32-ADCCP"
202
+ - "CRC-32-PKZIP"
203
+ - "PKZIP"
204
+ ...snip...
205
+ ```
206
+
207
+
208
+ ## CRC の逆算 (arc-crc)
209
+
210
+ crc-0.4 にて、任意の CRC となるバイト列を逆算する機能が正式に追加されました。
211
+
212
+ `require "crc/acrc"` にて、その機能が利用可能となります。
213
+
214
+ 名前の由来は、arc-sin などの C 関数である asin と同様に、arc-crc => acrc となっています。
215
+
216
+ 以下は使用例です。
217
+
218
+ * 文字列 "123456789????" を CRC32 した場合に 0 となるような、???? の部分を逆算する
219
+
220
+ ``` ruby:ruby
221
+ require "crc/acrc"
222
+
223
+ seq = "123456789"
224
+ seq << CRC.crc32.acrc(seq)
225
+ p CRC.crc32[seq] # => #<CRC::CRC32:00000000>
226
+ ```
227
+
228
+ * 文字列 "123456789????ABCDEFG" の、???? の部分を逆算する
229
+
230
+ ``` ruby:ruby
231
+ require "crc/acrc"
232
+
233
+ seq1 = "123456789"
234
+ seq2 = "ABCDEFG"
235
+ seq = seq1 + CRC.crc32.acrc(seq1, seq2) + seq2
236
+ p CRC.crc32[seq] # => #<CRC::CRC32:00000000>
237
+ ```
238
+
239
+ * 文字列 "123456789????ABCDEFG" を CRC32 した場合に 0x12345678 となるような、???? の部分を逆算する
240
+
241
+ ``` ruby:ruby
242
+ require "crc/acrc"
243
+
244
+ seq1 = "123456789"
245
+ seq2 = "ABCDEFG"
246
+ target_crc = 0x12345678
247
+ seq = seq1 + CRC.crc32.acrc(seq1, seq2, target_crc) + seq2
248
+ p CRC.crc32[seq] # => #<CRC::CRC32:12345678>
249
+ ```
250
+
251
+ * 独自仕様の CRC モジュールにも対応
252
+
253
+ ``` ruby:ruby
254
+ require "crc/acrc"
255
+
256
+ seq1 = "123456789"
257
+ seq2 = "ABCDEFG"
258
+ target_crc = 0x12345678
259
+ MyCRC = CRC.new(29, rand(1 << 29) | 1)
260
+ seq = seq1 + MyCRC.acrc(seq1, seq2, target_crc) + seq2
261
+ p MyCRC[seq] # => #<MyCRC:12345678>
262
+ ```
263
+
264
+
265
+ ## 諸元
266
+
267
+ - package name: crc
268
+ - author: dearblue (mailto:dearblue@users.noreply.github.com)
269
+ - report issue to: <https://github.com/dearblue/ruby-crc/issues>
270
+ - how to install: `gem install crc`
271
+ - version: 0.4.1
272
+ - production quality: TECHNICAL PREVIEW
273
+ - licensing:
274
+ - ***2 clause BSD License: MAIN LICENSE***
275
+ - zlib-style License: `lib/crc/_combine.rb`
276
+ - Creative Commons License Zero (CC0 / Public Domain): `lib/crc/_byruby.rb`, `lib/crc/_models.rb`
277
+ - dependency gems: none
278
+ - dependency external C libraries: none
279
+ - bundled external C libraries: none
280
+ - installed executable file:
281
+ - `rbcrc`: CRC calcuration source code generator for c, ruby and javascript
data/README.md CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
- # crc - CRC calcurator for ruby
2
+ # crc - CRC calculator for ruby
3
3
 
4
- This is a general CRC (Cyclic Redundancy Check) calcurator for ruby.
4
+ This is a generic CRC (Cyclic Redundancy Check) calculator for ruby.
5
5
 
6
6
  It is written by pure ruby with based on slice-by-eight algorithm (slice-by-16 algorithm with byte-order free).
7
7
 
8
- Included built-in CRC modules are CRC-32, CRC-32C, CRC-64-XZ, CRC-16, CRC-8-MAXIM, CRC-5-USB and many more.
8
+ Included built-in CRC models are CRC-32, CRC-32C, CRC-64-XZ, CRC-16, CRC-8-MAXIM, CRC-5-USB and many more.
9
9
 
10
10
  Customization is posible for 1 to 64 bit width, any polynomials, and with/without bit reflection input/output.
11
11
 
12
12
  This library is slower than ×85+ of zlib/crc32, and slower than ×120+ of extlzma/crc32 on FreeBSD 10.3R amd64.
13
13
 
14
- If you need more speed, please use with [crc-turbo](https://rubygems/gems/crc-turbo).
14
+ If you need more speed, please use with [crc-turbo](https://rubygems.org/gems/crc-turbo).
15
15
 
16
16
 
17
17
  ## Summary
@@ -20,34 +20,34 @@ If you need more speed, please use with [crc-turbo](https://rubygems/gems/crc-tu
20
20
  * author: dearblue (mailto:dearblue@users.noreply.github.com)
21
21
  * report issue to: <https://github.com/dearblue/ruby-crc/issues>
22
22
  * how to install: ``gem install crc``
23
- * version: 0.4.1
23
+ * version: 0.4.2
24
24
  * production quality: TECHNICAL PREVIEW
25
25
  * licensing:
26
26
  * ***BSD-2-Clause : MAIN LICENSE***
27
27
  * zlib-style License : ``lib/crc/_combine.rb``
28
- * Creative Commons License Zero (CC0 / Public Domain) : ``lib/crc/_byruby.rb``, ``lib/crc/_modules.rb``
28
+ * Creative Commons License Zero (CC0 / Public Domain) : ``lib/crc/_byruby.rb``, ``lib/crc/_models.rb``
29
29
  * dependency gems: none
30
30
  * dependency external C libraries: none
31
31
  * bundled external C libraries: none
32
32
  * installed executable file:
33
- * rbcrc: CRC calcuration source code generator for c, ruby and javascript
33
+ * rbcrc: CRC calculation source code generator for c, ruby and javascript
34
34
 
35
35
 
36
36
  ## API Guide
37
37
 
38
- This examples are used CRC-32 module. Please see CRC for more details.
38
+ This examples are used CRC-32 model. Please see CRC for more details.
39
39
 
40
- ### Calcurate by direct
40
+ ### Calculate by direct
41
41
 
42
42
  * ``CRC.crc32(seq, init = CRC::CRC32.initial_crc) => crc-32 integer`` (likely as ``Zlib.crc32``)
43
43
  * ``CRC.crc32.crc(seq, init = CRC::CRC32.initial_crc) => crc-32 integer`` (likely as ``Zlib.crc32``)
44
44
  * ``CRC.crc32.digest(seq, init = CRC::CRC32.initial_crc) => crc-32 digest`` (likely as ``Digest::XXXX.digest``)
45
45
  * ``CRC.crc32.hexdigest(seq, init = CRC::CRC32.initial_crc) -> crc-32 hex-digest`` (likely as ``Digest::XXXX.hexdigest``)
46
- * ``CRC.crc32[seq, init = CRC::CRC32.initial_crc, current_length = 0] -> crc-32 calcurator``
46
+ * ``CRC.crc32[seq, init = CRC::CRC32.initial_crc, current_length = 0] -> crc-32 calculator``
47
47
 
48
- ### Calcurate by streaming
48
+ ### Calculate by streaming
49
49
 
50
- * ``CRC.crc32.new(init = 0, current_length = 0) => crc-32 calcurator``
50
+ * ``CRC.crc32.new(init = 0, current_length = 0) => crc-32 calculator``
51
51
  * ``CRC::CRC32#update(seq) => self`` (likely as ``Digest::XXXX.update``)
52
52
  * ``CRC::CRC32#finish => crc-32 integer`` (likely as ``Digest::XXXX.finish``)
53
53
  * ``CRC::CRC32#crc => crc-32 integer`` (same as ``CRC::CRC32#finish``)
@@ -68,7 +68,7 @@ x.hexdigest # => "CBF43926"
68
68
  ### Combine
69
69
 
70
70
  * ``CRC.combine(crc1, crc2, len2) => combined crc integer`` (likely as ``Zlib.crc32_comibne``)
71
- * ``CRC#+(right_crc) => combined crc calcurator``
71
+ * ``CRC#+(right_crc) => combined crc calculator``
72
72
 
73
73
  Example-1 ::
74
74
 
@@ -82,9 +82,9 @@ Example-2 ::
82
82
  CRC.crc32["123"] + CRC.crc32["456"] + CRC.crc32["789"] # => #<CRC::CRC32:CBF43926>
83
83
  ```
84
84
 
85
- ### Create customized crc module
85
+ ### Create customized crc model
86
86
 
87
- * ``CRC.new(bitsize, poly, initial_crc = 0, refin = true, refout = true, xor_output = ~0) => new crc module class``
87
+ * ``CRC.new(bitsize, poly, initial_crc = 0, refin = true, refout = true, xor_output = ~0) => new crc model class``
88
88
 
89
89
  Example ::
90
90
 
@@ -95,7 +95,7 @@ MyCRC32.hexdigest("123456789") # => "CBF43926"
95
95
  MyCRC32["123456789"] # => #<MyCRC32:CBF43926>
96
96
  ```
97
97
 
98
- ### Calcurate arc-crc
98
+ ### Calculate arc-crc
99
99
 
100
100
  * ``CRC::XXX.acrc(pre, post = nil, want_crc = 0) => arc-crc byte string``
101
101
 
@@ -109,10 +109,10 @@ b = CRC.crc32.acrc(a, c, wantcrc) # => "3456"
109
109
  CRC.crc32[a + b + c] # => #<CRC::CRC32:CBF43926>
110
110
  ```
111
111
 
112
- See CRC::Calcurate.acrc or below for more detail.
112
+ See CRC::Calculate.acrc or below for more detail.
113
113
 
114
114
 
115
- ## Built-in CRC modules
115
+ ## Built-in CRC models
116
116
 
117
117
  ```
118
118
  $ rbcrc -lq
@@ -134,9 +134,9 @@ CRC-1, CRC-3-ROHC, CRC-4-INTERLAKEN, CRC-4-ITU, CRC-5-EPC, CRC-5-ITU, CRC-5-USB,
134
134
  CRC.combine is ported from Mark Adler's crccomb.c in <https://stackoverflow.com/questions/29915764/generic-crc-8-16-32-64-combine-implementation#29928573>.
135
135
 
136
136
 
137
- ## Source code generator for the specific CRC calcurator (from crc-0.3.1)
137
+ ## Source code generator for the specific CRC calculator (from crc-0.3.1)
138
138
 
139
- Add source code generator for the specific CRC calcurator to c, ruby, and javascript.
139
+ Add source code generator for the specific CRC calculator to c, ruby, and javascript.
140
140
 
141
141
  Algorithm is slicing-by-16 only for ruby and javascript.
142
142
 
@@ -180,22 +180,22 @@ Support export file types:
180
180
  (executable for mruby and limitation bitsize by fixnum)
181
181
 
182
182
  examples:
183
- * create crc-32 calcurator to c source (and header file)
183
+ * create crc-32 calculator to c source (and header file)
184
184
  $ rbcrc crc32.c
185
185
 
186
- * create crc-32c calcurator to ruby source
186
+ * create crc-32c calculator to ruby source
187
187
  $ rbcrc crc32c.rb
188
188
 
189
- * create crc-30-cdma calcurator to javascript source
189
+ * create crc-30-cdma calculator to javascript source
190
190
  $ rbcrc crc30cdma.js
191
191
 
192
- * create crc-32 calcurator to ``crc.c'', ``crc.rb'' and ``crc.js''
192
+ * create crc-32 calculator to ``crc.c'', ``crc.rb'' and ``crc.js''
193
193
  $ rbcrc -mcrc32 crc.c crc.rb crc.js
194
194
 
195
- * create customized crc calcurator (as mycrc function) to ``mycrc.c''
195
+ * create customized crc calculator (as mycrc function) to ``mycrc.c''
196
196
  $ rbcrc -s15 -p0x6789 -io -x~0 mycrc.c
197
197
 
198
- * create customized crc calcurator (as MyCRC class) to ``mycrc_1.rb''
198
+ * create customized crc calculator (as MyCRC class) to ``mycrc_1.rb''
199
199
  $ rbcrc -s39 -p0x987654321 -IO -x1 -nMyCRC mycrc_1.rb
200
200
  ```
201
201
 
data/bin/rbcrc CHANGED
@@ -108,22 +108,22 @@ Support export file types:
108
108
  (executable for mruby and limitation bitsize by fixnum)
109
109
 
110
110
  examples:
111
- * create crc-32 calcurator to c source (and header file)
111
+ * create crc-32 calculator to c source (and header file)
112
112
  $ rbcrc crc32.c
113
113
 
114
- * create crc-32c calcurator to ruby source
114
+ * create crc-32c calculator to ruby source
115
115
  $ rbcrc crc32c.rb
116
116
 
117
- * create crc-30-cdma calcurator to javascript source
117
+ * create crc-30-cdma calculator to javascript source
118
118
  $ rbcrc crc30cdma.js
119
119
 
120
- * create crc-32 calcurator to ``crc.c'', ``crc.rb'' and ``crc.js''
120
+ * create crc-32 calculator to ``crc.c'', ``crc.rb'' and ``crc.js''
121
121
  $ rbcrc -mcrc32 crc.c crc.rb crc.js
122
122
 
123
- * create customized crc calcurator (as mycrc function) to ``mycrc.c''
123
+ * create customized crc calculator (as mycrc function) to ``mycrc.c''
124
124
  $ rbcrc -s15 -p0x6789 -io -x~0 mycrc.c
125
125
 
126
- * create customized crc calcurator (as MyCRC class) to ``mycrc_1.rb''
126
+ * create customized crc calculator (as MyCRC class) to ``mycrc_1.rb''
127
127
  $ rbcrc -s39 -p0x987654321 -IO -x1 -nMyCRC mycrc_1.rb
128
128
  EOS
129
129
 
data/gemstub.rb CHANGED
@@ -9,9 +9,9 @@ ver = $1
9
9
  GEMSTUB = Gem::Specification.new do |s|
10
10
  s.name = "crc"
11
11
  s.version = ver
12
- s.summary = "general CRC calcurator"
12
+ s.summary = "generic CRC calculator"
13
13
  s.description = <<EOS
14
- Pure ruby implemented general CRC (Cyclic Redundancy Check) calcurator.
14
+ Pure ruby implemented generic CRC (Cyclic Redundancy Check) calculator.
15
15
  Customization is posible for 1 to 64 bit width, any polynomials, and with/without bit reflection input/output.
16
16
  If you need more speed, please use crc-turbo.
17
17
  EOS
data/lib/crc.rb CHANGED
@@ -17,15 +17,15 @@ end
17
17
  require_relative "crc/version"
18
18
 
19
19
  #
20
- # This is a general CRC calcurator.
20
+ # This is a generic CRC calculator.
21
21
  #
22
- # When you want to use CRC-32 module, there are following ways:
22
+ # When you want to use CRC-32 model, there are following ways:
23
23
  #
24
- # 1. Calcurate CRC-32'd value at direct:
24
+ # 1. Calculate CRC-32'd value at direct:
25
25
  #
26
26
  # CRC.crc32("123456789") # => 3421780262
27
27
  #
28
- # 2. Calcurate CRC-32'd hex-digest at direct:
28
+ # 2. Calculate CRC-32'd hex-digest at direct:
29
29
  #
30
30
  # CRC::CRC32.hexdigest("123456789") # => "CBF43926"
31
31
  #
@@ -51,7 +51,7 @@ class CRC
51
51
 
52
52
  using Extensions
53
53
 
54
- module Calcurator
54
+ module Calculator
55
55
  def [](seq, *args)
56
56
  c = new(*args)
57
57
  c.update(seq) if seq
@@ -157,20 +157,20 @@ class CRC
157
157
  # initialize(initial_crc = nil, size = 0)
158
158
  #
159
159
  def initialize(initial_crc = nil, size = 0)
160
- m = get_crc_module
160
+ m = get_crc_model
161
161
  @state = m.setup((initial_crc || m.initial_crc).to_i)
162
162
  @size = size.to_i
163
163
  end
164
164
 
165
165
  def reset(initial_crc = nil, size = 0)
166
- m = get_crc_module
166
+ m = get_crc_model
167
167
  @state = m.setup((initial_crc || m.initial_crc).to_i)
168
168
  @size = size.to_i
169
169
  self
170
170
  end
171
171
 
172
172
  def update(seq)
173
- @state = get_crc_module.update(seq, state)
173
+ @state = get_crc_model.update(seq, state)
174
174
  @size += seq.bytesize
175
175
  self
176
176
  end
@@ -178,15 +178,15 @@ class CRC
178
178
  alias << update
179
179
 
180
180
  def crc
181
- get_crc_module.finish(state)
181
+ get_crc_model.finish(state)
182
182
  end
183
183
 
184
184
  def +(crc2)
185
- m1 = get_crc_module
186
- m2 = crc2.get_crc_module
185
+ m1 = get_crc_model
186
+ m2 = crc2.get_crc_model
187
187
  raise ArgumentError, "not a CRC instance (#{crc2.inspect})" unless m2
188
188
  unless m2.variant_for?(m1)
189
- raise ArgumentError, "different CRC module (#{m1.inspect} and #{m2.inspect})"
189
+ raise ArgumentError, "different CRC model (#{m1.inspect} and #{m2.inspect})"
190
190
  end
191
191
  m1.new(m1.combine(crc, crc2.crc, crc2.size), size + crc2.size)
192
192
  end
@@ -214,66 +214,70 @@ class CRC
214
214
  end
215
215
 
216
216
  def digest
217
- Aux.digest(crc, get_crc_module.bitsize)
217
+ Aux.digest(crc, get_crc_model.bitsize)
218
218
  end
219
219
 
220
220
  # return digest as internal state
221
221
  def digest!
222
- Aux.digest(state, get_crc_module.bitsize)
222
+ Aux.digest(state, get_crc_model.bitsize)
223
223
  end
224
224
 
225
225
  def hexdigest
226
- Aux.hexdigest(crc, get_crc_module.bitsize)
226
+ Aux.hexdigest(crc, get_crc_model.bitsize)
227
227
  end
228
228
 
229
229
  # return hex-digest as internal state
230
230
  def hexdigest!
231
- Aux.hexdigest(state, get_crc_module.bitsize)
231
+ Aux.hexdigest(state, get_crc_model.bitsize)
232
232
  end
233
233
 
234
234
  alias to_str hexdigest
235
235
  alias to_s hexdigest
236
236
 
237
237
  def inspect
238
- "\#<#{get_crc_module}:#{hexdigest}>"
238
+ "\#<#{get_crc_model}:#{hexdigest}>"
239
239
  end
240
240
 
241
241
  def pretty_inspect(q)
242
242
  q.text inspect
243
243
  end
244
244
 
245
- MODULE_TABLE = {}
245
+ MODEL_TABLE = {}
246
246
 
247
247
  class << self
248
- def lookup(modulename)
249
- modulename1 = modulename.to_s.gsub(/[\W_]+/, "")
250
- modulename1.downcase!
251
- MODULE_TABLE[modulename1] or raise NameError, "modulename is not matched (for #{modulename})"
248
+ def lookup(modelname)
249
+ modelname1 = modelname.to_s.gsub(/[\W_]+/, "")
250
+ modelname1.downcase!
251
+ MODEL_TABLE[modelname1] or raise NameError, "modelname is not matched (for #{modelname})"
252
252
  end
253
253
 
254
254
  alias [] lookup
255
255
 
256
- def crc(modulename, seq, crc = nil)
257
- lookup(modulename).crc(seq, crc)
256
+ def crc(modelname, seq, crc = nil)
257
+ lookup(modelname).crc(seq, crc)
258
258
  end
259
259
 
260
- def digest(modulename, seq, crc = nil)
261
- lookup(modulename).digest(seq, crc)
260
+ def digest(modelname, seq, crc = nil)
261
+ lookup(modelname).digest(seq, crc)
262
262
  end
263
263
 
264
- def hexdigest(modulename, seq, crc = nil)
265
- lookup(modulename).hexdigest(seq, crc)
264
+ def hexdigest(modelname, seq, crc = nil)
265
+ lookup(modelname).hexdigest(seq, crc)
266
266
  end
267
267
  end
268
268
 
269
- require_relative "crc/_modules"
269
+ # NOTE: "Calcurator" は typo ですが、後方互換のため一時的に残します。
270
+ # TODO: CRC::Calcurator はいずれ削除されます。
271
+ CRC::Calcurator = CRC::Calculator
272
+
273
+ require_relative "crc/_models"
270
274
  require_relative "crc/_combine"
271
275
  require_relative "crc/_shift"
272
276
  require_relative "crc/_magic"
273
277
  require_relative "crc/_file"
274
278
 
275
279
  #
276
- # Create CRC module classes.
280
+ # Create CRC model classes.
277
281
  #
278
282
  LIST.each do |bitsize, polynomial, refin, refout, initial_crc, xor, check, *names|
279
283
  names.flatten!
@@ -284,10 +288,10 @@ class CRC
284
288
 
285
289
  names.each do |nm|
286
290
  nm1 = nm.downcase.gsub(/[\W_]+/, "")
287
- if MODULE_TABLE.key?(nm1)
288
- raise NameError, "collision crc-module name: #{nm} ({#{crc.to_str}} and {#{MODULE_TABLE[nm1].to_str}})"
291
+ if MODEL_TABLE.key?(nm1)
292
+ raise NameError, "collision crc-model name: #{nm} ({#{crc.to_str}} and {#{MODEL_TABLE[nm1].to_str}})"
289
293
  end
290
- MODULE_TABLE[nm1] = crc
294
+ MODEL_TABLE[nm1] = crc
291
295
 
292
296
  name = nm.sub(/(?<=\bCRC)-(?=\d+)/, "").gsub(/[\W]+/, "_")
293
297
  const_set(name, crc)
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # \* \* \* \* \* \* \* \*
11
11
  #
12
- # Pure ruby implemented general CRC calcurator.
12
+ # Pure ruby implemented generic CRC calculator.
13
13
  # It's used slice-by-16 algorithm with byte-order free.
14
14
  # This is based on the Intel's slice-by-eight algorithm.
15
15
  #
@@ -27,8 +27,8 @@ class CRC
27
27
  class << self
28
28
  #
29
29
  # call-seq:
30
- # new(bitsize, polynomial, initial_crc = 0, reflect_input = true, reflect_output = true, xor_output = ~0, name = nil) -> new crc module class (CRC based class)
31
- # new(initial_crc = nil, size = 0) -> new crc calcurator (CRC instance)
30
+ # new(bitsize, polynomial, initial_crc = 0, reflect_input = true, reflect_output = true, xor_output = ~0, name = nil) -> new crc model class (CRC based class)
31
+ # new(initial_crc = nil, size = 0) -> new crc calculator (CRC instance)
32
32
  #
33
33
  def new(bitsize, polynomial, initial_crc = 0, reflect_input = true, reflect_output = true, xor_output = ~0, name = nil)
34
34
  bitsize = bitsize.to_i
@@ -56,7 +56,7 @@ class CRC
56
56
  # CRC クラスを普通に派生させた場合でも、CRC.new の基底メソッドが呼ばれるための細工
57
57
  define_singleton_method(:new, &Class.instance_method(:new).bind(self))
58
58
 
59
- extend CRC::Calcurator
59
+ extend CRC::Calculator
60
60
  end
61
61
  end
62
62
 
@@ -254,7 +254,7 @@ class CRC
254
254
  end
255
255
  end
256
256
 
257
- module Calcurator
257
+ module Calculator
258
258
  attr_reader :bitsize, :bitmask, :polynomial, :initial_crc,
259
259
  :reflect_input, :reflect_output, :xor_output, :name
260
260
 
@@ -91,7 +91,7 @@ class CRC
91
91
  refine CRC do
92
92
  def convert_internal_state_for(crc)
93
93
  unless crc.variant?(self)
94
- raise "not variant crc module (expect #{crc.to_s}, but self is #{inspect})"
94
+ raise "not variant crc model (expect #{crc.to_s}, but self is #{inspect})"
95
95
  end
96
96
 
97
97
  state
@@ -99,7 +99,7 @@ class CRC
99
99
 
100
100
  def convert_target_state_for(crc)
101
101
  unless crc.variant?(self)
102
- raise "not variant crc module (expect #{crc.to_s}, but self is #{inspect})"
102
+ raise "not variant crc model (expect #{crc.to_s}, but self is #{inspect})"
103
103
  end
104
104
 
105
105
  state
@@ -168,12 +168,12 @@ class CRC
168
168
  end
169
169
 
170
170
  # refinements:
171
- # * get_crc_module
171
+ # * get_crc_model
172
172
  # * variant_for?
173
173
  ;
174
174
 
175
175
  refine BasicObject do
176
- def get_crc_module
176
+ def get_crc_model
177
177
  nil
178
178
  end
179
179
 
@@ -183,18 +183,18 @@ class CRC
183
183
  end
184
184
 
185
185
  refine CRC do
186
- alias get_crc_module class
186
+ alias get_crc_model class
187
187
 
188
188
  def variant_for?(m)
189
- get_crc_module.variant_for?(m)
189
+ get_crc_model.variant_for?(m)
190
190
  end
191
191
  end
192
192
 
193
193
  refine CRC.singleton_class do
194
- alias get_crc_module itself
194
+ alias get_crc_model itself
195
195
 
196
196
  def variant_for?(m)
197
- return false unless m = m.get_crc_module
197
+ return false unless m = m.get_crc_model
198
198
 
199
199
  if bitsize == m.bitsize &&
200
200
  polynomial == m.polynomial &&
@@ -7,7 +7,7 @@ class CRC
7
7
  self
8
8
  end
9
9
 
10
- module Calcurator
10
+ module Calculator
11
11
  def file(path, *args)
12
12
  new(*args).file(path)
13
13
  end
@@ -35,8 +35,8 @@ class CRC
35
35
 
36
36
  refine CRC do
37
37
  def to_magicdigest_for(m)
38
- unless m.variant?(get_crc_module)
39
- raise TypeError, "different crc type - #{get_crc_module.inspect} (expect #{m.inspect})", caller
38
+ unless m.variant?(get_crc_model)
39
+ raise TypeError, "different crc type - #{get_crc_model.inspect} (expect #{m.inspect})", caller
40
40
  end
41
41
 
42
42
  magicdigest
@@ -45,7 +45,7 @@ class CRC
45
45
 
46
46
  refine BasicObject do
47
47
  def to_magicdigest_for(m)
48
- raise TypeError, "cant convert type - #{get_crc_module}", caller
48
+ raise TypeError, "cant convert type - #{get_crc_model}", caller
49
49
  end
50
50
  end
51
51
 
@@ -60,7 +60,7 @@ class CRC
60
60
 
61
61
  using CRC::Extensions
62
62
 
63
- module Calcurator
63
+ module Calculator
64
64
  def magicnumber
65
65
  @magicnumber = crc(__cached_magic_code__)
66
66
  singleton_class.class_eval { attr_reader :magicnumber }
@@ -88,6 +88,6 @@ class CRC
88
88
  end
89
89
 
90
90
  def magicdigest
91
- crc.to_magicdigest_for(get_crc_module)
91
+ crc.to_magicdigest_for(get_crc_model)
92
92
  end
93
93
  end
@@ -78,11 +78,11 @@ class CRC
78
78
  [16, 0x6F63, false, false, 0, 0, 0xBDF4, "CRC-16-LJ1200"],
79
79
  [16, 0x8005, true, true, ~0, ~0, 0x44C2, "CRC-16-MAXIM"],
80
80
  [16, 0x1021, true, true, ~0, 0, 0x6F91, "CRC-16-MCRF4XX"],
81
- [16, 0x1021, true, true, 0xB2AA, 0, 0x63D0, "CRC-16-RIELLO"],
81
+ [16, 0x1021, true, true, 0x554D, 0, 0x63D0, "CRC-16-RIELLO"],
82
82
  [16, 0xA097, false, false, 0, 0, 0x0FB3, "CRC-16-TELEDISK"],
83
- [16, 0x1021, true, true, 0x89EC, 0, 0x26B1, "CRC-16-TMS37157"],
83
+ [16, 0x1021, true, true, 0x3791, 0, 0x26B1, "CRC-16-TMS37157"],
84
84
  [16, 0x8005, true, true, 0, ~0, 0xB4C8, "CRC-16-USB"],
85
- [16, 0x1021, true, true, 0xC6C6, 0, 0xBF05, "CRC-16-A", "CRC-A", "CRC-16-ISO/IEC FCD 14443-3"],
85
+ [16, 0x1021, true, true, 0x6363, 0, 0xBF05, "CRC-16-A", "CRC-A", "CRC-16-ISO/IEC FCD 14443-3"],
86
86
  [16, 0x1021, true, true, 0, 0, 0x2189, "CRC-16-KERMIT", "KERMIT", "CRC-16-CCITT", "CRC-16-CCITT-TRUE", "CRC-CCITT"],
87
87
  [16, 0x8005, true, true, ~0, 0, 0x4B37, "CRC-16-MODBUS", "MODBUS"],
88
88
  [16, 0x1021, true, true, 0, ~0, 0x906E, "CRC-16-X-25", "X-25", "CRC-16-IBM-SDLC", "CRC-16-ISO-HDLC", "CRC-16-CRC-B", "CRC-B"],
@@ -92,7 +92,7 @@ class CRC
92
92
  #[24, 0x005D6DCB, false, false, 0, 0, nil, "CRC-24"],
93
93
  [24, 0x00864CFB, false, false, 0, 0, 0x00CDE703, "CRC-24-Radix-64"],
94
94
  [24, 0x00864CFB, false, false, 0x00B704CE, 0, 0x0021CF02, "CRC-24-OPENPGP"],
95
- [24, 0x0000065B, true, true, 0x00555555, 0, 0x00C25A56, "CRC-24-BLE"],
95
+ [24, 0x0000065B, true, true, 0x00AAAAAA, 0, 0x00C25A56, "CRC-24-BLE"],
96
96
  [24, 0x005D6DCB, false, false, 0x00FEDCBA, 0, 0x007979BD, "CRC-24-FLEXRAY-A"],
97
97
  [24, 0x005D6DCB, false, false, 0x00ABCDEF, 0, 0x001F23B8, "CRC-24-FLEXRAY-B"],
98
98
  [24, 0x00328B63, false, false, 0, ~0, 0x00B4F3E6, "CRC-24-INTERLAKEN"],
@@ -3,7 +3,7 @@ require_relative "_extensions"
3
3
  class CRC
4
4
  using Extensions
5
5
 
6
- module Calcurator
6
+ module Calculator
7
7
  #
8
8
  # call-seq:
9
9
  # shiftbits_by_bitbybit(bitset, state) -> state
@@ -5,7 +5,7 @@ require_relative "../crc"
5
5
  class CRC
6
6
  using CRC::Extensions
7
7
 
8
- module Calcurator
8
+ module Calculator
9
9
  #
10
10
  # call-seq:
11
11
  # acrc(pre, post = nil, targetcrc = 0) -> byte string as arc-code
@@ -1,5 +1,5 @@
1
1
  #!ruby
2
2
 
3
3
  class CRC
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
@@ -7,14 +7,14 @@ require "optparse"
7
7
  alltest = false
8
8
  opt = OptionParser.new(nil, 12, " ")
9
9
  opt.instance_eval do
10
- on("--all", "test all crc modules") { alltest = true }
10
+ on("--all", "test all crc models") { alltest = true }
11
11
  order!
12
12
  end
13
13
 
14
14
  if alltest
15
- $testmodules = CRC::MODULE_TABLE.values.uniq
15
+ $testmodels = CRC::MODEL_TABLE.values.uniq
16
16
  else
17
- $testmodules = %w(
17
+ $testmodels = %w(
18
18
  CRC-32 CRC-32-POSIX CRC-64 CRC-64-ECMA
19
19
  CRC-3-ROHC CRC-5-USB CRC-7-ROHC CRC-7-UMTS CRC-8-CCITT CRC-8-MAXIM
20
20
  CRC-15 CRC-16 CRC-16-XMODEM CRC-24-OPENPGP CRC-24-BLE CRC-31-PHILIPS
@@ -1,9 +1,9 @@
1
1
  require "crc"
2
2
 
3
- $stderr.puts "#{__FILE__}:#{__LINE__}: SELF CHECK for CRC modules (#{File.basename($".grep(/_(?:byruby|turbo)/)[0]||"")})\n"
3
+ $stderr.puts "#{__FILE__}:#{__LINE__}: SELF CHECK for CRC models (#{File.basename($".grep(/_(?:byruby|turbo)/)[0]||"")})\n"
4
4
 
5
5
  class CRC
6
- MODULE_TABLE.values.uniq.each do |crc|
6
+ MODEL_TABLE.values.uniq.each do |crc|
7
7
  check = crc::CHECK
8
8
  checked = crc.crc("123456789")
9
9
  case check
@@ -7,7 +7,7 @@ require "crc/acrc"
7
7
  require "securerandom"
8
8
 
9
9
  class TestArcCRC < Test::Unit::TestCase
10
- $testmodules.each do |crc|
10
+ $testmodels.each do |crc|
11
11
  class_eval(<<-"EOS", __FILE__, __LINE__ + 1)
12
12
  def test_arc_#{crc.to_s.slice(/\w+$/)}
13
13
  crc = #{crc}
@@ -5,7 +5,7 @@ require "crc"
5
5
  require_relative "common"
6
6
 
7
7
  class TestCRC < Test::Unit::TestCase
8
- $testmodules.each do |crc|
8
+ $testmodels.each do |crc|
9
9
  next unless crc.const_defined?(:CHECK) && crc::CHECK
10
10
  class_eval(<<-"EOS", __FILE__, __LINE__ + 1)
11
11
  def test_block_#{crc.to_s.slice(/\w+$/)}
@@ -5,7 +5,7 @@ require "crc"
5
5
  require_relative "common"
6
6
 
7
7
  class TestCRCMagic < Test::Unit::TestCase
8
- $testmodules.each do |crc|
8
+ $testmodels.each do |crc|
9
9
  next unless crc.const_defined?(:CHECK) && crc::CHECK
10
10
  name = crc.to_s.slice(/\w+$/)
11
11
  class_eval(<<-"TESTCODE", __FILE__, __LINE__ + 1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - dearblue
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
11
+ date: 2020-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '12'
27
27
  description: |
28
- Pure ruby implemented general CRC (Cyclic Redundancy Check) calcurator.
28
+ Pure ruby implemented generic CRC (Cyclic Redundancy Check) calculator.
29
29
  Customization is posible for 1 to 64 bit width, any polynomials, and with/without bit reflection input/output.
30
30
  If you need more speed, please use crc-turbo.
31
31
  email: dearblue@users.noreply.github.com
@@ -36,6 +36,7 @@ extensions: []
36
36
  extra_rdoc_files:
37
37
  - HISTORY.ja.md
38
38
  - LICENSE
39
+ - README.ja.md
39
40
  - README.md
40
41
  - lib/crc.rb
41
42
  - lib/crc/_aux.rb
@@ -44,7 +45,7 @@ extra_rdoc_files:
44
45
  - lib/crc/_extensions.rb
45
46
  - lib/crc/_file.rb
46
47
  - lib/crc/_magic.rb
47
- - lib/crc/_modules.rb
48
+ - lib/crc/_models.rb
48
49
  - lib/crc/_shift.rb
49
50
  - lib/crc/_utils.rb
50
51
  - lib/crc/acrc.rb
@@ -54,6 +55,7 @@ extra_rdoc_files:
54
55
  files:
55
56
  - HISTORY.ja.md
56
57
  - LICENSE
58
+ - README.ja.md
57
59
  - README.md
58
60
  - Rakefile
59
61
  - benchmark.rb
@@ -67,7 +69,7 @@ files:
67
69
  - lib/crc/_extensions.rb
68
70
  - lib/crc/_file.rb
69
71
  - lib/crc/_magic.rb
70
- - lib/crc/_modules.rb
72
+ - lib/crc/_models.rb
71
73
  - lib/crc/_shift.rb
72
74
  - lib/crc/_utils.rb
73
75
  - lib/crc/acrc.rb
@@ -85,7 +87,7 @@ licenses:
85
87
  - Zlib
86
88
  - CC0-1.0
87
89
  metadata: {}
88
- post_install_message:
90
+ post_install_message:
89
91
  rdoc_options:
90
92
  - "--charset"
91
93
  - UTF-8
@@ -104,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
106
  - !ruby/object:Gem::Version
105
107
  version: '0'
106
108
  requirements: []
107
- rubyforge_project:
108
- rubygems_version: 2.6.11
109
- signing_key:
109
+ rubygems_version: 3.0.6
110
+ signing_key:
110
111
  specification_version: 4
111
- summary: general CRC calcurator
112
+ summary: generic CRC calculator
112
113
  test_files: []