crc 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.ja.md +22 -0
- data/README.md +140 -30
- data/benchmark.rb +15 -9
- data/gemstub.rb +6 -5
- data/lib/crc.rb +211 -220
- data/lib/crc/_byruby.rb +89 -65
- data/lib/crc/_combine.rb +5 -5
- data/lib/crc/_modules.rb +24 -23
- data/lib/crc/acrc.rb +195 -0
- data/lib/crc/finder.rb +4 -4
- data/lib/crc/version.rb +5 -0
- metadata +12 -10
data/lib/crc/finder.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
#!ruby
|
2
|
+
|
1
3
|
require_relative "../crc"
|
2
4
|
|
3
|
-
|
5
|
+
class CRC
|
4
6
|
def self.find(crc, seq, bitsize, polynomial, initstate = [0, ~0, 1], xor = [0, ~0, 1])
|
5
7
|
bitsize0 = bitsize.to_i
|
6
8
|
if bitsize0 < 1 || bitsize0 > 128
|
@@ -10,8 +12,6 @@ module CRC
|
|
10
12
|
crc &= bitmask
|
11
13
|
results = []
|
12
14
|
poly = Array(polynomial)
|
13
|
-
#poly += poly.map { |po| Utils.bitreflect(po, bitsize0) }
|
14
|
-
#poly.uniq!
|
15
15
|
poly.each do |poly|
|
16
16
|
poly &= bitmask
|
17
17
|
[false, true].each do |refin|
|
@@ -20,7 +20,7 @@ module CRC
|
|
20
20
|
xormask &= bitmask
|
21
21
|
Array(initstate).each do |init|
|
22
22
|
init &= bitmask
|
23
|
-
mod = CRC.
|
23
|
+
mod = CRC.new(bitsize0, poly, init, refin, refout, xormask)
|
24
24
|
results << mod if mod.crc(seq) == crc
|
25
25
|
end
|
26
26
|
end
|
data/lib/crc/version.rb
ADDED
metadata
CHANGED
@@ -1,34 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dearblue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
description: |
|
28
28
|
This is a general CRC (Cyclic Redundancy Check) generator for ruby.
|
29
|
-
It is written by pure ruby
|
30
|
-
|
31
|
-
Additional your customized CRC modules are defined to posible.
|
29
|
+
It is written by pure ruby.
|
30
|
+
Customization is posible for 1 to 64 bit width, any polynomial primitives, and with/without bit reflection input/output.
|
32
31
|
If you need more speed, please use crc-turbo.
|
33
32
|
email: dearblue@users.osdn.me
|
34
33
|
executables: []
|
@@ -41,7 +40,9 @@ extra_rdoc_files:
|
|
41
40
|
- lib/crc/_byruby.rb
|
42
41
|
- lib/crc/_combine.rb
|
43
42
|
- lib/crc/_modules.rb
|
43
|
+
- lib/crc/acrc.rb
|
44
44
|
- lib/crc/finder.rb
|
45
|
+
- lib/crc/version.rb
|
45
46
|
files:
|
46
47
|
- HISTORY.ja.md
|
47
48
|
- LICENSE
|
@@ -53,7 +54,9 @@ files:
|
|
53
54
|
- lib/crc/_byruby.rb
|
54
55
|
- lib/crc/_combine.rb
|
55
56
|
- lib/crc/_modules.rb
|
57
|
+
- lib/crc/acrc.rb
|
56
58
|
- lib/crc/finder.rb
|
59
|
+
- lib/crc/version.rb
|
57
60
|
homepage: https://osdn.jp/projects/rutsubo/
|
58
61
|
licenses:
|
59
62
|
- BSD-2-Clause
|
@@ -85,4 +88,3 @@ signing_key:
|
|
85
88
|
specification_version: 4
|
86
89
|
summary: general CRC generator
|
87
90
|
test_files: []
|
88
|
-
has_rdoc:
|