pax_global_header00006660000000000000000000000064147461100450014514gustar00rootroot0000000000000052 comment=d7ab5572612f1a9b6e3043ba538267600758181d postmodern-digest-crc-4adf113/000077500000000000000000000000001474611004500163355ustar00rootroot00000000000000postmodern-digest-crc-4adf113/.github/000077500000000000000000000000001474611004500176755ustar00rootroot00000000000000postmodern-digest-crc-4adf113/.github/workflows/000077500000000000000000000000001474611004500217325ustar00rootroot00000000000000postmodern-digest-crc-4adf113/.github/workflows/integration.yml000066400000000000000000000011161474611004500247770ustar00rootroot00000000000000name: CI on: push: tags: [ 'v0.*' ] pull_request: paths: [ 'ext/**' ] jobs: tests: runs-on: ubuntu-latest strategy: fail-fast: false name: Integration Testing steps: - uses: actions/checkout@v4 - name: Set up Docker uses: docker-practice/actions-setup-docker@master - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 - name: Install dependencies run: bundle install --jobs 4 --retry 3 - name: Run integration tests run: bundle exec rake spec:integration postmodern-digest-crc-4adf113/.github/workflows/ruby.yml000066400000000000000000000012531474611004500234370ustar00rootroot00000000000000name: CI on: [ push, pull_request ] jobs: tests: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: - ubuntu-latest - macos-latest ruby: - '3.0' - '3.1' - '3.2' - '3.3' - jruby - truffleruby name: OS ${{ matrix.os }} / Ruby ${{ matrix.ruby }} steps: - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: bundle install --jobs 4 --retry 3 - name: Run tests run: bundle exec rake spec postmodern-digest-crc-4adf113/.gitignore000066400000000000000000000003071474611004500203250ustar00rootroot00000000000000Gemfile.lock doc pkg .bundle .yardoc /ext/digest/crc*/Makefile /ext/digest/crc*/mkmf.log /ext/digest/crc*/extconf.h /ext/digest/crc*/*.o /ext/digest/crc*/*.so /spec/integration/docker/digest-crc.gem postmodern-digest-crc-4adf113/.rspec000066400000000000000000000000401474611004500174440ustar00rootroot00000000000000--colour --format documentation postmodern-digest-crc-4adf113/.yardopts000066400000000000000000000001421474611004500202000ustar00rootroot00000000000000--markup markdown --title 'Digest CRC Documentation' --protected --files ChangeLog.md,LICENSE.txt postmodern-digest-crc-4adf113/ChangeLog.md000066400000000000000000000223151474611004500205110ustar00rootroot00000000000000### 0.7.0 / 2025-01-28 * Added {Digest::CRC64NVMe}. * Added {Digest::CRC.implementation}. * Reduced duplicate code. ### 0.6.5 / 2023-07-03 * Corrected the implementation of {Digest::CRC5}. * Make `digest-crc` Ractor-safe. ### 0.6.4 / 2021-07-14 * Silence potential method redefinition warnings when loading the C extensions. (@ojab) ### 0.6.3 / 2020-12-19 * Broaden rake dependency to >= 12.0.0, < 14.0.0` for ruby 2.7, which includes rake 13.x. ### 0.6.2 / 2020-12-03 * Lower the rake dependency to `~> 12.0` for ruby 2.6. * Fixed a bug in `ext/digest/Rakefile` which prevented digest-crc from being installed on systems where C extensions could not be successfully compiled. * Rake's `ruby` method, which in turn calls rake's `sh` method, raises a `RuntimeError` exception when the ruby command fails, causing rake to exit with an error code. Instead, rescue any `RuntimeError` exceptions and fail gracefully. ### 0.6.1 / 2020-07-02 * Fix installation issues under bundler by adding rake as an explicit dependency (@rogerluan). ### 0.6.0 / 2020-07-01 * Implement _optional_ C extensions for all CRC algorithms, resulting in an average performance improvement of ~40x. Note, if for whatever reason the C extensions cannot be compiled, they will be skipped and the pure-Ruby CRC algorithms will be used instead. If the C extensions were successfully compiled, then they will be loaded and override the pure-Ruby CRC methods with the C equivalents. * Alias {Digest::CRC16QT} to {Digest::CRC16X25}, since they are effectively the same (@dearblue). * Fix {Digest::CRC32::WIDTH} (@dearblue). #### pure-Ruby (ruby 2.7.1) Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.412953 0.000000 0.412953 ( 0.414688) Digest::CRC5#update 1.116375 0.000003 1.116378 ( 1.120741) Digest::CRC8#update 0.994263 0.000013 0.994276 ( 1.001079) Digest::CRC8_1Wire#update 0.974115 0.000004 0.974119 ( 0.978186) Digest::CRC15#update 1.139402 0.000927 1.140329 ( 1.146608) Digest::CRC16#update 0.967836 0.000000 0.967836 ( 0.971792) Digest::CRC16CCITT#update 1.118851 0.000000 1.118851 ( 1.123217) Digest::CRC16DNP#update 0.922211 0.000000 0.922211 ( 0.925739) Digest::CRC16Genibus#update 1.120580 0.000000 1.120580 ( 1.124771) Digest::CRC16Modbus#update 0.955612 0.000000 0.955612 ( 0.959463) Digest::CRC16QT#update 8.153403 0.000012 8.153415 ( 8.189977) Digest::CRC16USB#update 0.952557 0.000000 0.952557 ( 0.956145) Digest::CRC16X25#update 0.962295 0.000000 0.962295 ( 0.970401) Digest::CRC16XModem#update 1.120531 0.000000 1.120531 ( 1.124494) Digest::CRC16ZModem#update 1.124226 0.000000 1.124226 ( 1.128632) Digest::CRC24#update 1.126317 0.000000 1.126317 ( 1.130794) Digest::CRC32#update 0.960015 0.000000 0.960015 ( 0.964803) Digest::CRC32BZip2#update 1.128626 0.000000 1.128626 ( 1.133641) Digest::CRC32c#update 0.964047 0.000000 0.964047 ( 0.967456) Digest::CRC32Jam#update 0.959141 0.000972 0.960113 ( 0.967444) Digest::CRC32MPEG#update 1.131119 0.000002 1.131121 ( 1.137440) Digest::CRC32POSIX#update 1.126019 0.000000 1.126019 ( 1.130549) Digest::CRC32XFER#update 1.116598 0.000000 1.116598 ( 1.120595) Digest::CRC64#update 2.665880 0.000928 2.666808 ( 2.680942) Digest::CRC64Jones#update 2.678003 0.000000 2.678003 ( 2.691390) Digest::CRC64XZ#update 2.671395 0.000000 2.671395 ( 2.682684) #### pure-Ruby (jruby 9.2.11.1) Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.700000 0.070000 0.770000 ( 0.436112) Digest::CRC5#update 1.930000 0.050000 1.980000 ( 1.084749) Digest::CRC8#update 1.510000 0.060000 1.570000 ( 0.979123) Digest::CRC8_1Wire#update 0.730000 0.030000 0.760000 ( 0.761309) Digest::CRC15#update 1.760000 0.080000 1.840000 ( 1.061413) Digest::CRC16#update 1.560000 0.030000 1.590000 ( 0.951273) Digest::CRC16CCITT#update 1.700000 0.010000 1.710000 ( 1.046854) Digest::CRC16DNP#update 1.490000 0.000000 1.490000 ( 0.902434) Digest::CRC16Genibus#update 1.820000 0.020000 1.840000 ( 1.030269) Digest::CRC16Modbus#update 0.740000 0.010000 0.750000 ( 0.738604) Digest::CRC16QT#update 7.280000 0.040000 7.320000 ( 6.399987) Digest::CRC16USB#update 0.930000 0.000000 0.930000 ( 0.801541) Digest::CRC16X25#update 0.870000 0.000000 0.870000 ( 0.805130) Digest::CRC16XModem#update 1.320000 0.010000 1.330000 ( 0.968956) Digest::CRC16ZModem#update 1.300000 0.010000 1.310000 ( 0.928303) Digest::CRC24#update 1.550000 0.020000 1.570000 ( 1.024450) Digest::CRC32#update 1.260000 0.000000 1.260000 ( 0.913814) Digest::CRC32BZip2#update 1.210000 0.010000 1.220000 ( 0.919086) Digest::CRC32c#update 0.770000 0.010000 0.780000 ( 0.761726) Digest::CRC32Jam#update 0.930000 0.000000 0.930000 ( 0.800468) Digest::CRC32MPEG#update 1.240000 0.010000 1.250000 ( 0.933962) Digest::CRC32POSIX#update 1.290000 0.010000 1.300000 ( 0.925254) Digest::CRC32XFER#update 1.270000 0.000000 1.270000 ( 0.920521) Digest::CRC64#update 3.480000 0.020000 3.500000 ( 2.883794) Digest::CRC64Jones#update 2.740000 0.000000 2.740000 ( 2.738251) Digest::CRC64XZ#update 2.780000 0.010000 2.790000 ( 2.715833) #### C extensions (ruby 2.7.1) Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.407438 0.000000 0.407438 ( 0.410495) Digest::CRC5#update 0.022873 0.000000 0.022873 ( 0.023796) Digest::CRC8#update 0.020129 0.000000 0.020129 ( 0.020887) Digest::CRC8_1Wire#update 0.020106 0.000000 0.020106 ( 0.020897) Digest::CRC15#update 0.028765 0.000003 0.028768 ( 0.029549) Digest::CRC16#update 0.022176 0.000856 0.023032 ( 0.023153) Digest::CRC16CCITT#update 0.028570 0.000000 0.028570 ( 0.028691) Digest::CRC16DNP#update 0.023240 0.000001 0.023241 ( 0.024008) Digest::CRC16Genibus#update 0.028692 0.000000 0.028692 ( 0.029575) Digest::CRC16Modbus#update 0.023928 0.000000 0.023928 ( 0.024859) Digest::CRC16QT#update 7.965822 0.000968 7.966790 ( 8.001781) Digest::CRC16USB#update 0.023448 0.000001 0.023449 ( 0.024420) Digest::CRC16X25#update 0.023061 0.000000 0.023061 ( 0.023861) Digest::CRC16XModem#update 0.029407 0.000000 0.029407 ( 0.030583) Digest::CRC16ZModem#update 0.029522 0.000000 0.029522 ( 0.030438) Digest::CRC24#update 0.029528 0.000000 0.029528 ( 0.030504) Digest::CRC32#update 0.023306 0.000000 0.023306 ( 0.024278) Digest::CRC32BZip2#update 0.026346 0.000000 0.026346 ( 0.027293) Digest::CRC32c#update 0.023525 0.000000 0.023525 ( 0.024489) Digest::CRC32Jam#update 0.023348 0.000000 0.023348 ( 0.023477) Digest::CRC32MPEG#update 0.026287 0.000000 0.026287 ( 0.027394) Digest::CRC32POSIX#update 0.026063 0.000000 0.026063 ( 0.026986) Digest::CRC32XFER#update 0.026374 0.000000 0.026374 ( 0.027314) Digest::CRC64#update 0.023523 0.000000 0.023523 ( 0.024484) Digest::CRC64Jones#update 0.023479 0.000000 0.023479 ( 0.024432) Digest::CRC64XZ#update 0.024146 0.000000 0.024146 ( 0.025129) ### 0.5.1 / 2020-03-03 * Fixed XOR logic in {Digest::CRC16Genibus}. * Freeze all `TABLE` constants. * Added missing documentation. ### 0.5.0 / 2020-03-01 * Added {Digest::CRC15}. * Added {Digest::CRC16Genibus}. * Added {Digest::CRC16Kermit}. * Added {Digest::CRC16X25}. * Added {Digest::CRC32BZip2}. * Added {Digest::CRC32Jam}. * Added {Digest::CRC32POSIX}. * Added {Digest::CRC32XFER}. * Added {Digest::CRC64Jones}. * Added {Digest::CRC64XZ}. * Renamed `Digest::CRC32Mpeg` to {Digest::CRC32MPEG}. * Renamed `Digest::CRC81Wire` to {Digest::CRC8_1Wire}. ### 0.4.2 / 2020-03-01 * Corrected the logic in {Digest::CRC32#update}. * Added missing {Digest::CRC5.pack} method. * Fixed a require in `digest/crc8_1wire.rb`. ### 0.4.1 / 2014-04-16 * Allow Digest CRC classes to be extended and their constants overriden. * Allow {Digest::CRC5::CRC_MASK} to be overriden by subclasses. * {Digest::CRC81Wire} now inherites from {Digest::CRC8}. ### 0.4.0 / 2013-02-13 * Added {Digest::CRC16QT}. ### 0.3.0 / 2011-09-24 * Added {Digest::CRC81Wire} (Henry Garner). ### 0.2.0 / 2011-05-10 * Added {Digest::CRC32c}. * Opted into [test.rubygems.org](http://test.rubygems.org/) * Switched from using Jeweler and Bundler, to using [Ore::Tasks](http://github.com/ruby-ore/ore-tasks). ### 0.1.0 / 2010-06-01 * Initial release. * CRC1 * CRC5 * CRC8 * CRC16 * CRC16 CCITT * CRC16 DNP * CRC16 Modbus * CRC16 USB * CRC16 XModem * CRC16 ZModem * CRC24 * CRC32 * CRC32 Mpeg * CRC64 postmodern-digest-crc-4adf113/Gemfile000066400000000000000000000004171474611004500176320ustar00rootroot00000000000000source 'https://rubygems.org' gemspec group :development do gem 'rake' gem 'rubygems-tasks', '~> 0.2' gem 'rspec', '~> 3.0' gem 'simplecov', '~> 0.20' gem 'yard', '~> 0.9' gem 'kramdown' gem 'kramdown-parser-gfm' gem 'github-markup', '~> 1.1' end postmodern-digest-crc-4adf113/LICENSE.txt000066400000000000000000000020451474611004500201610ustar00rootroot00000000000000Copyright (c) 2010-2025 Hal Brodigan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. postmodern-digest-crc-4adf113/README.md000066400000000000000000000501531474611004500176200ustar00rootroot00000000000000# Digest CRC [![CI](https://github.com/postmodern/digest-crc/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/digest-crc/actions/workflows/ruby.yml) * [Source](https://github.com/postmodern/digest-crc) * [Issues](https://github.com/postmodern/digest-crc/issues) * [Documentation](http://rubydoc.info/gems/digest-crc/frames) ## Description Adds support for calculating Cyclic Redundancy Check (CRC) to the Digest module. ## Features * Provides support for the following CRC algorithms: * [CRC1](https://rubydoc.info/gems/digest-crc/Digest/CRC1) * [CRC5](https://rubydoc.info/gems/digest-crc/Digest/CRC5) * [CRC8](https://rubydoc.info/gems/digest-crc/Digest/CRC8) * [CRC8 1-Wire](https://rubydoc.info/gems/digest-crc/Digest/CRC8_1Wire) * [CRC15](https://rubydoc.info/gems/digest-crc/Digest/CRC15) * [CRC16](https://rubydoc.info/gems/digest-crc/Digest/CRC16) * [CRC16 CCITT](https://rubydoc.info/gems/digest-crc/Digest/CRC16CCITT) * [CRC16 DNP](https://rubydoc.info/gems/digest-crc/Digest/CRC16DNP) * [CRC16 Genibus](https://rubydoc.info/gems/digest-crc/Digest/CRC16Genibus) * [CRC16 Kermit](https://rubydoc.info/gems/digest-crc/Digest/CRC16Kermit) * [CRC16 Modbus](https://rubydoc.info/gems/digest-crc/Digest/CRC16Modbus) * [CRC16 USB](https://rubydoc.info/gems/digest-crc/Digest/CRC16USB) * [CRC16 X25](https://rubydoc.info/gems/digest-crc/Digest/CRC16X25) * [CRC16 XModem](https://rubydoc.info/gems/digest-crc/Digest/CRC16XModem) * [CRC16 ZModem](https://rubydoc.info/gems/digest-crc/Digest/CRC16ZModem) * [CRC16 QT](https://rubydoc.info/gems/digest-crc/Digest/CRC16QT) * [CRC24](https://rubydoc.info/gems/digest-crc/Digest/CRC24) * [CRC32](https://rubydoc.info/gems/digest-crc/Digest/CRC32) * [CRC32 BZip2](https://rubydoc.info/gems/digest-crc/Digest/CRC32BZip2) * [CRC32c](https://rubydoc.info/gems/digest-crc/Digest/CRC32c) * [CRC32 Jam](https://rubydoc.info/gems/digest-crc/Digest/CRC32Jam) * [CRC32 MPEG](https://rubydoc.info/gems/digest-crc/Digest/CRC32MPEG) * [CRC32 POSIX](https://rubydoc.info/gems/digest-crc/Digest/CRC32POSIX) * [CRC32 XFER](https://rubydoc.info/gems/digest-crc/Digest/CRC32XFER) * [CRC64](https://rubydoc.info/gems/digest-crc/Digest/CRC64) * [CRC64 Jones](https://rubydoc.info/gems/digest-crc/Digest/CRC64Jones) * [CRC64 NVMe](https://rubydoc.info/gems/digest-crc/Digest/CRC64Nvme) * [CRC64 XZ](https://rubydoc.info/gems/digest-crc/Digest/CRC64XZ) * Pure Ruby implementation. * Provides CRC Tables for optimized calculations. * Supports _optional_ C extensions which increases performance by ~40x. * If the C extensions cannot be compiled for whatever reason, digest-crc will automatically fallback to the pure-Ruby implementation. ## Install ``` gem install digest-crc ``` **Note:** to enable the C extensions ensure that you are using CRuby and have a C compiler (`gcc` or `clang`) and `make` installed, _before_ installing digest-crc. * Debian / Ubuntu: $ sudo apt install gcc make * RedHat / Fedora: $ sudo dnf install gcc make * Alpine Linux: $ apk add build-base * macOS: install XCode ## Examples Calculate a CRC32: ```ruby require 'digest/crc32' Digest::CRC32.hexdigest('hello') # => "3610a686" ``` Calculate a CRC32 of a file: ```ruby Digest::CRC32.file('README.md') # => # ``` Incrementally calculate a CRC32: ```ruby crc = Digest::CRC32.new crc << 'one' crc << 'two' crc << 'three' crc.hexdigest # => "09e1c092" ``` Directly access the checksum: ```ruby crc.checksum # => 165789842 ``` Defining your own CRC class: ```ruby require 'digest/crc32' module Digest class CRC3000 < CRC32 WIDTH = 32 REFLECT_INPUT = true INIT_CRC = 0xffffffff XOR_MASK = 0xffffffff TABLE = [ # .... ].freeze end end ``` ## Benchmarks ### Ruby 2.7.4 (pure Ruby) $ bundle exec rake clean $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.423741 0.000000 0.423741 ( 0.425887) Digest::CRC5#update 1.486578 0.000011 1.486589 ( 1.493215) Digest::CRC8#update 1.261386 0.000000 1.261386 ( 1.266399) Digest::CRC8_1Wire#update 1.250344 0.000000 1.250344 ( 1.255009) Digest::CRC15#update 1.482515 0.000000 1.482515 ( 1.488131) Digest::CRC16#update 1.216744 0.000811 1.217555 ( 1.222228) Digest::CRC16CCITT#update 1.480490 0.000000 1.480490 ( 1.486745) Digest::CRC16DNP#update 1.200067 0.000000 1.200067 ( 1.204835) Digest::CRC16Genibus#update 1.492910 0.000000 1.492910 ( 1.498923) Digest::CRC16Modbus#update 1.217449 0.000003 1.217452 ( 1.222348) Digest::CRC16QT#update 1.223311 0.000000 1.223311 ( 1.229211) Digest::CRC16USB#update 1.233744 0.000000 1.233744 ( 1.238615) Digest::CRC16X25#update 1.223077 0.000000 1.223077 ( 1.227607) Digest::CRC16XModem#update 1.487674 0.000000 1.487674 ( 1.493316) Digest::CRC16ZModem#update 1.484288 0.000000 1.484288 ( 1.490096) Digest::CRC24#update 1.490272 0.000000 1.490272 ( 1.496027) Digest::CRC32#update 1.225311 0.000000 1.225311 ( 1.230572) Digest::CRC32BZip2#update 1.503096 0.000000 1.503096 ( 1.509202) Digest::CRC32c#update 1.220390 0.000000 1.220390 ( 1.225487) Digest::CRC32Jam#update 1.216066 0.000000 1.216066 ( 1.220591) Digest::CRC32MPEG#update 1.486808 0.000000 1.486808 ( 1.492611) Digest::CRC32POSIX#update 1.494508 0.000957 1.495465 ( 1.503262) Digest::CRC32XFER#update 1.504802 0.005830 1.510632 ( 1.522066) Digest::CRC64#update 3.260784 0.015674 3.276458 ( 3.310506) Digest::CRC64Jones#update 3.195204 0.000000 3.195204 ( 3.213054) Digest::CRC64XZ#update 3.173597 0.000000 3.173597 ( 3.190438) ### Ruby 2.7.4 (C extensions) $ bundle exec rake build:c_exts ... $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.443619 0.000007 0.443626 ( 0.446545) Digest::CRC5#update 0.025134 0.000806 0.025940 ( 0.026129) Digest::CRC8#update 0.022564 0.000000 0.022564 ( 0.022775) Digest::CRC8_1Wire#update 0.021427 0.000008 0.021435 ( 0.021551) Digest::CRC15#update 0.030377 0.000833 0.031210 ( 0.031406) Digest::CRC16#update 0.024004 0.000002 0.024006 ( 0.024418) Digest::CRC16CCITT#update 0.026930 0.000001 0.026931 ( 0.027238) Digest::CRC16DNP#update 0.024279 0.000000 0.024279 ( 0.024446) Digest::CRC16Genibus#update 0.026477 0.000004 0.026481 ( 0.026656) Digest::CRC16Modbus#update 0.023568 0.000000 0.023568 ( 0.023704) Digest::CRC16QT#update 0.024161 0.000000 0.024161 ( 0.024316) Digest::CRC16USB#update 0.023891 0.000000 0.023891 ( 0.024038) Digest::CRC16X25#update 0.023849 0.000000 0.023849 ( 0.023991) Digest::CRC16XModem#update 0.026254 0.000000 0.026254 ( 0.026523) Digest::CRC16ZModem#update 0.026391 0.000000 0.026391 ( 0.026529) Digest::CRC24#update 0.028805 0.000854 0.029659 ( 0.029830) Digest::CRC32#update 0.024030 0.000000 0.024030 ( 0.024200) Digest::CRC32BZip2#update 0.026942 0.000000 0.026942 ( 0.027244) Digest::CRC32c#update 0.023989 0.000000 0.023989 ( 0.024159) Digest::CRC32Jam#update 0.023940 0.000000 0.023940 ( 0.024066) Digest::CRC32MPEG#update 0.027063 0.000000 0.027063 ( 0.027213) Digest::CRC32POSIX#update 0.027137 0.000000 0.027137 ( 0.028160) Digest::CRC32XFER#update 0.026956 0.000002 0.026958 ( 0.027103) Digest::CRC64#update 0.024222 0.000005 0.024227 ( 0.024796) Digest::CRC64Jones#update 0.025331 0.000000 0.025331 ( 0.025789) Digest::CRC64XZ#update 0.024131 0.000001 0.024132 ( 0.024348) ### Ruby 3.0.2 (pure Ruby) $ bundle exec rake clean $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.331405 0.000002 0.331407 ( 0.333588) Digest::CRC5#update 1.206847 0.000020 1.206867 ( 1.224072) Digest::CRC8#update 1.018571 0.000000 1.018571 ( 1.023002) Digest::CRC8_1Wire#update 1.018802 0.000000 1.018802 ( 1.023292) Digest::CRC15#update 1.207586 0.000000 1.207586 ( 1.212691) Digest::CRC16#update 1.032505 0.000965 1.033470 ( 1.040862) Digest::CRC16CCITT#update 1.198079 0.000000 1.198079 ( 1.203134) Digest::CRC16DNP#update 0.994582 0.000000 0.994582 ( 1.006520) Digest::CRC16Genibus#update 1.190596 0.000000 1.190596 ( 1.196087) Digest::CRC16Modbus#update 1.007826 0.000000 1.007826 ( 1.012934) Digest::CRC16QT#update 0.996298 0.000001 0.996299 ( 1.000255) Digest::CRC16USB#update 0.995806 0.000000 0.995806 ( 0.999822) Digest::CRC16X25#update 1.019589 0.000000 1.019589 ( 1.031010) Digest::CRC16XModem#update 1.146947 0.000000 1.146947 ( 1.150817) Digest::CRC16ZModem#update 1.145145 0.000000 1.145145 ( 1.149483) Digest::CRC24#update 1.149009 0.000000 1.149009 ( 1.152854) Digest::CRC32#update 0.970976 0.000000 0.970976 ( 0.974227) Digest::CRC32BZip2#update 1.148596 0.000000 1.148596 ( 1.152381) Digest::CRC32c#update 0.972566 0.000000 0.972566 ( 0.975790) Digest::CRC32Jam#update 0.975854 0.000000 0.975854 ( 0.979217) Digest::CRC32MPEG#update 1.148578 0.000000 1.148578 ( 1.153088) Digest::CRC32POSIX#update 1.146218 0.000986 1.147204 ( 1.152460) Digest::CRC32XFER#update 1.149823 0.000000 1.149823 ( 1.153692) Digest::CRC64#update 2.869948 0.000016 2.869964 ( 2.884261) Digest::CRC64Jones#update 2.867662 0.000000 2.867662 ( 2.886559) Digest::CRC64XZ#update 2.858847 0.000000 2.858847 ( 2.874058) ### Ruby 3.0.2 (C extensions) $ bundle exec rake build:c_exts ... $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.349055 0.000000 0.349055 ( 0.350454) Digest::CRC5#update 0.023144 0.000000 0.023144 ( 0.023248) Digest::CRC8#update 0.021378 0.000000 0.021378 ( 0.021522) Digest::CRC8_1Wire#update 0.021019 0.000000 0.021019 ( 0.021145) Digest::CRC15#update 0.030063 0.000003 0.030066 ( 0.030245) Digest::CRC16#update 0.024395 0.000000 0.024395 ( 0.024572) Digest::CRC16CCITT#update 0.026979 0.000000 0.026979 ( 0.027138) Digest::CRC16DNP#update 0.024665 0.000000 0.024665 ( 0.024844) Digest::CRC16Genibus#update 0.027054 0.000000 0.027054 ( 0.027217) Digest::CRC16Modbus#update 0.023963 0.000000 0.023963 ( 0.024257) Digest::CRC16QT#update 0.024218 0.000000 0.024218 ( 0.024360) Digest::CRC16USB#update 0.024393 0.000000 0.024393 ( 0.024561) Digest::CRC16X25#update 0.025127 0.000000 0.025127 ( 0.025292) Digest::CRC16XModem#update 0.028123 0.000000 0.028123 ( 0.028377) Digest::CRC16ZModem#update 0.028205 0.000000 0.028205 ( 0.028571) Digest::CRC24#update 0.031386 0.000000 0.031386 ( 0.031740) Digest::CRC32#update 0.023832 0.000000 0.023832 ( 0.023948) Digest::CRC32BZip2#update 0.027159 0.000000 0.027159 ( 0.027315) Digest::CRC32c#update 0.024172 0.000000 0.024172 ( 0.024310) Digest::CRC32Jam#update 0.024376 0.000000 0.024376 ( 0.024494) Digest::CRC32MPEG#update 0.026035 0.000784 0.026819 ( 0.026940) Digest::CRC32POSIX#update 0.026784 0.000000 0.026784 ( 0.026907) Digest::CRC32XFER#update 0.026770 0.000000 0.026770 ( 0.026893) Digest::CRC64#update 0.024400 0.000009 0.024409 ( 0.024531) Digest::CRC64Jones#update 0.023477 0.000781 0.024258 ( 0.024390) Digest::CRC64XZ#update 0.024611 0.000000 0.024611 ( 0.024779) ### JRuby 9.2.18.0 (pure Ruby) $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 1.080000 0.050000 1.130000 ( 0.676022) Digest::CRC5#update 2.030000 0.040000 2.070000 ( 1.089240) Digest::CRC8#update 1.590000 0.000000 1.590000 ( 0.999138) Digest::CRC8_1Wire#update 0.920000 0.010000 0.930000 ( 0.873813) Digest::CRC15#update 1.470000 0.030000 1.500000 ( 1.118886) Digest::CRC16#update 1.780000 0.010000 1.790000 ( 1.067874) Digest::CRC16CCITT#update 1.500000 0.070000 1.570000 ( 1.185564) Digest::CRC16DNP#update 1.250000 0.000000 1.250000 ( 0.972322) Digest::CRC16Genibus#update 1.700000 0.010000 1.710000 ( 1.092047) Digest::CRC16Modbus#update 1.000000 0.010000 1.010000 ( 0.915328) Digest::CRC16QT#update 1.250000 0.000000 1.250000 ( 0.968528) Digest::CRC16USB#update 1.150000 0.010000 1.160000 ( 0.990387) Digest::CRC16X25#update 0.940000 0.000000 0.940000 ( 0.926926) Digest::CRC16XModem#update 1.390000 0.010000 1.400000 ( 1.100584) Digest::CRC16ZModem#update 1.760000 0.020000 1.780000 ( 1.094003) Digest::CRC24#update 1.690000 0.010000 1.700000 ( 1.106875) Digest::CRC32#update 1.410000 0.020000 1.430000 ( 1.082506) Digest::CRC32BZip2#update 1.510000 0.010000 1.520000 ( 1.104225) Digest::CRC32c#update 1.270000 0.010000 1.280000 ( 1.023881) Digest::CRC32Jam#update 1.190000 0.010000 1.200000 ( 0.998146) Digest::CRC32MPEG#update 1.580000 0.010000 1.590000 ( 1.099086) Digest::CRC32POSIX#update 1.550000 0.010000 1.560000 ( 1.142051) Digest::CRC32XFER#update 1.360000 0.000000 1.360000 ( 1.071381) Digest::CRC64#update 3.730000 0.020000 3.750000 ( 2.780390) Digest::CRC64Jones#update 2.710000 0.020000 2.730000 ( 2.608007) Digest::CRC64XZ#update 2.910000 0.020000 2.930000 ( 2.629401) ### TruffleRuby 21.2.0 (pure Ruby) $ bundle exec rake clean $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.455340 0.000000 0.455340 ( 0.457710) Digest::CRC5#update 1.406700 0.000000 1.406700 ( 1.412535) Digest::CRC8#update 1.248323 0.000000 1.248323 ( 1.255452) Digest::CRC8_1Wire#update 1.269434 0.000000 1.269434 ( 1.275315) Digest::CRC15#update 1.428752 0.000000 1.428752 ( 1.434836) Digest::CRC16#update 1.220394 0.000967 1.221361 ( 1.229684) Digest::CRC16CCITT#update 1.434932 0.001000 1.435932 ( 1.452391) Digest::CRC16DNP#update 1.191351 0.000000 1.191351 ( 1.202262) Digest::CRC16Genibus#update 1.434067 0.000000 1.434067 ( 1.440300) Digest::CRC16Modbus#update 1.200827 0.000000 1.200827 ( 1.205658) Digest::CRC16QT#update 1.195077 0.000000 1.195077 ( 1.200328) Digest::CRC16USB#update 1.196266 0.000000 1.196266 ( 1.201262) Digest::CRC16X25#update 1.206690 0.000000 1.206690 ( 1.211781) Digest::CRC16XModem#update 1.430468 0.000000 1.430468 ( 1.436801) Digest::CRC16ZModem#update 1.442524 0.000000 1.442524 ( 1.448624) Digest::CRC24#update 1.447611 0.000018 1.447629 ( 1.454534) Digest::CRC32#update 1.214314 0.000000 1.214314 ( 1.219838) Digest::CRC32BZip2#update 1.427408 0.000000 1.427408 ( 1.433626) Digest::CRC32c#update 1.204985 0.000000 1.204985 ( 1.210273) Digest::CRC32Jam#update 1.235039 0.000000 1.235039 ( 1.240686) Digest::CRC32MPEG#update 1.429731 0.000000 1.429731 ( 1.435404) Digest::CRC32POSIX#update 1.458886 0.000000 1.458886 ( 1.465914) Digest::CRC32XFER#update 1.422109 0.000000 1.422109 ( 1.427635) Digest::CRC64#update 3.283506 0.000000 3.283506 ( 3.303129) Digest::CRC64Jones#update 3.297402 0.000000 3.297402 ( 3.317357) Digest::CRC64XZ#update 3.278551 0.001875 3.280426 ( 3.315165) ### TruffleRuby 21.2.0 (C extensions) $ bundle exec rake build:c_exts ... $ bundle exec ./benchmarks.rb Loading Digest::CRC classes ... Generating 1000 8Kb lengthed strings ... Benchmarking Digest::CRC classes ... user system total real Digest::CRC1#update 0.480586 0.000014 0.480600 ( 0.482817) Digest::CRC5#update 0.023795 0.000000 0.023795 ( 0.023941) Digest::CRC8#update 0.020619 0.000000 0.020619 ( 0.020747) Digest::CRC8_1Wire#update 0.020571 0.000000 0.020571 ( 0.020700) Digest::CRC15#update 0.031224 0.000000 0.031224 ( 0.031412) Digest::CRC16#update 0.024013 0.000000 0.024013 ( 0.024174) Digest::CRC16CCITT#update 0.026790 0.000000 0.026790 ( 0.027079) Digest::CRC16DNP#update 0.024253 0.000000 0.024253 ( 0.024427) Digest::CRC16Genibus#update 0.027237 0.000000 0.027237 ( 0.027390) Digest::CRC16Modbus#update 0.024376 0.000000 0.024376 ( 0.024548) Digest::CRC16QT#update 0.024361 0.000000 0.024361 ( 0.024518) Digest::CRC16USB#update 0.024142 0.000000 0.024142 ( 0.024311) Digest::CRC16X25#update 0.024098 0.000000 0.024098 ( 0.024222) Digest::CRC16XModem#update 0.026306 0.000000 0.026306 ( 0.026502) Digest::CRC16ZModem#update 0.026536 0.000000 0.026536 ( 0.026688) Digest::CRC24#update 0.029732 0.000000 0.029732 ( 0.029902) Digest::CRC32#update 0.024219 0.000000 0.024219 ( 0.024391) Digest::CRC32BZip2#update 0.026817 0.000000 0.026817 ( 0.027044) Digest::CRC32c#update 0.023681 0.000000 0.023681 ( 0.023798) Digest::CRC32Jam#update 0.024243 0.000000 0.024243 ( 0.024419) Digest::CRC32MPEG#update 0.026865 0.000000 0.026865 ( 0.027020) Digest::CRC32POSIX#update 0.026583 0.000000 0.026583 ( 0.026748) Digest::CRC32XFER#update 0.027423 0.000000 0.027423 ( 0.027615) Digest::CRC64#update 0.024150 0.000000 0.024150 ( 0.024310) Digest::CRC64Jones#update 0.024218 0.000000 0.024218 ( 0.024363) Digest::CRC64XZ#update 0.024124 0.000000 0.024124 ( 0.024255) ## Crystal [crystal-crc] is a [Crystal][crystal-lang] port of this library. [crystal-crc]: https://github.com/postmodern/crystal-crc [crystal-lang]: https://www.crystal-lang.org/ ## Thanks Special thanks go out to the [pycrc](http://www.tty1.net/pycrc/) library which is able to generate C source-code for all of the CRC algorithms, including their CRC Tables. ## License Copyright (c) 2010-2025 Hal Brodigan See {file:LICENSE.txt} for license information. postmodern-digest-crc-4adf113/Rakefile000066400000000000000000000022711474611004500200040ustar00rootroot00000000000000require 'rubygems' begin require 'bundler/setup' rescue LoadError => e abort e.message end require 'rake' require 'rubygems/tasks' Gem::Tasks.new namespace :build do desc "Builds the C extensions" task :c_exts do Dir.chdir('ext/digest') { sh 'rake' } end end require 'rake/clean' CLEAN.include('ext/digest/crc*/extconf.h') CLEAN.include('ext/digest/crc*/Makefile') CLEAN.include('ext/digest/crc*/*.o') CLEAN.include('ext/digest/crc*/*.so') file 'spec/integration/docker/digest-crc.gem' do |t| sh "gem build -o #{t.name} digest-crc.gemspec" end require 'rspec/core/rake_task' namespace :spec do RSpec::Core::RakeTask.new(:pure) do |t| t.exclude_pattern = 'spec/integration/*_spec.rb' end task :pure => :clean if RUBY_ENGINE == 'ruby' RSpec::Core::RakeTask.new(:c_exts) do |t| t.exclude_pattern = 'spec/integration/*_spec.rb' end task :c_exts => 'build:c_exts' end RSpec::Core::RakeTask.new(:integration) do |t| t.pattern = 'spec/integration/*_spec.rb' end end task :spec => 'spec:pure' task :spec => 'spec:c_exts' if RUBY_ENGINE == 'ruby' task :test => :spec task :default => :spec require 'yard' YARD::Rake::YardocTask.new task :doc => :yard postmodern-digest-crc-4adf113/benchmarks.rb000077500000000000000000000030761474611004500210100ustar00rootroot00000000000000#!/usr/bin/env ruby require 'benchmark' $LOAD_PATH.unshift(File.expand_path('../ext',__FILE__)) $LOAD_PATH.unshift(File.expand_path('../lib',__FILE__)) CRCs = { 'crc1' => 'CRC1', 'crc5' => 'CRC5', 'crc8' => 'CRC8', 'crc8_1wire' => 'CRC81Wire', 'crc15' => 'CRC15', 'crc16' => 'CRC16', 'crc16_ccitt' => 'CRC16CCITT', 'crc16_dnp' => 'CRC16DNP', 'crc16_genibus' => 'CRC16Genibus', 'crc16_modbus' => 'CRC16Modbus', 'crc16_qt' => 'CRC16QT', 'crc16_usb' => 'CRC16USB', 'crc16_x_25' => 'CRC16X25', 'crc16_xmodem' => 'CRC16XModem', 'crc16_zmodem' => 'CRC16ZModem', 'crc24' => 'CRC24', 'crc32' => 'CRC32', 'crc32_bzip2' => 'CRC32BZip2', 'crc32c' => 'CRC32c', 'crc32_jam' => 'CRC32Jam', 'crc32_mpeg' => 'CRC32Mpeg', 'crc32_posix' => 'CRC32POSIX', 'crc32_xfer' => 'CRC32XFER', 'crc64' => 'CRC64', 'crc64_jones' => 'CRC64Jones', 'crc64_nvme' => 'CRC64NVMe', 'crc64_xz' => 'CRC64XZ', } puts "Loading Digest::CRC classes ..." CRCs.each_key { |crc| require "digest/#{crc}" } N = 1000 BLOCK_SIZE = 8 * 1024 puts "Generating #{N} #{BLOCK_SIZE / 1024}Kb lengthed strings ..." SAMPLES = Array.new(N) do Array.new(BLOCK_SIZE) { rand(256).chr }.join end puts "Benchmarking Digest::CRC classes ..." Benchmark.bm(27) do |b| CRCs.each_value do |crc| crc_class = Digest.const_get(crc) crc = crc_class.new b.report("#{crc_class}#update") do SAMPLES.each do |sample| crc.update(sample) end end end end postmodern-digest-crc-4adf113/digest-crc.gemspec000066400000000000000000000042741474611004500217350ustar00rootroot00000000000000# encoding: utf-8 require 'yaml' Gem::Specification.new do |gem| gemspec = YAML.load_file('gemspec.yml') gem.name = gemspec.fetch('name') gem.version = gemspec.fetch('version') do lib_dir = File.join(File.dirname(__FILE__),'lib') $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir) require 'digest/crc/version' Digest::CRC::VERSION end gem.summary = gemspec['summary'] gem.description = gemspec['description'] gem.licenses = Array(gemspec['license']) gem.authors = Array(gemspec['authors']) gem.email = gemspec['email'] gem.homepage = gemspec['homepage'] gem.metadata = gemspec['metadata'] if gemspec['metadata'] glob = ->(patterns) { gem.files & Dir[*patterns] } gem.files = if gemspec['files'] then glob[gemspec['files']] else `git ls-files`.split($/) end # exclude test files from the packages gem gem.files -= glob[gemspec['test_files'] || 'spec/{**/}*'] gem.executables = gemspec.fetch('executables') do glob['bin/*'].map { |path| File.basename(path) } end gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.' gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb'] gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb'] gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}'] gem.require_paths = Array(gemspec.fetch('require_paths') { %w[ext lib].select { |dir| File.directory?(dir) } }) gem.requirements = gemspec['requirements'] gem.required_ruby_version = gemspec['required_ruby_version'] gem.required_rubygems_version = gemspec['required_rubygems_version'] gem.post_install_message = gemspec['post_install_message'] split = ->(string) { string.split(/,\s*/) } if gemspec['dependencies'] gemspec['dependencies'].each do |name,versions| gem.add_dependency(name,split[versions]) end end if gemspec['development_dependencies'] gemspec['development_dependencies'].each do |name,versions| gem.add_development_dependency(name,split[versions]) end end end postmodern-digest-crc-4adf113/ext/000077500000000000000000000000001474611004500171355ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/000077500000000000000000000000001474611004500204145ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/Rakefile000066400000000000000000000016021474611004500220600ustar00rootroot00000000000000def fail_gracefully(message) warn "#{message}. Failing gracefully ..." exit end unless RUBY_ENGINE == 'ruby' fail_gracefully "C extensions for #{RUBY_ENGINE} currently not supported" end begin require "mkmf" rescue LoadError fail_gracefully "mkmf is not installed" end CRCS = Dir['crc*'] DLEXT = MakeMakefile::CONFIG['DLEXT'] CRCS.each do |crc| crc_ext = "#{crc}_ext" file "#{crc}/Makefile" => "#{crc}/extconf.rb" do Dir.chdir(crc) do begin ruby '-S', 'extconf.rb' rescue fail_gracefully "extconf.rb failed" end end end crc_ext_lib = "#{crc}_ext.#{DLEXT}" file "#{crc}/#{crc_ext_lib}" => "#{crc}/Makefile" do Dir.chdir(crc) do begin sh 'make', 'clean' sh 'make' rescue fail_gracefully "Unable to build C extensions" end end end task :default => "#{crc}/#{crc_ext_lib}" end postmodern-digest-crc-4adf113/ext/digest/compat/000077500000000000000000000000001474611004500216775ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/compat/ruby.h000066400000000000000000000003021474611004500230240ustar00rootroot00000000000000#ifndef _DIGEST_COMPAT_RUBY_H_ #define _DIGEST_COMPAT_RUBY_H_ #include // HACK: define USHORT2NUM for Ruby < 2.6 #ifndef USHORT2NUM #define USHORT2NUM(x) RB_INT2FIX(x) #endif #endif postmodern-digest-crc-4adf113/ext/digest/crc12_3gpp/000077500000000000000000000000001474611004500222575ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc12_3gpp/crc12_3gpp.c000066400000000000000000000054611474611004500242740ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:30:42 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 12 * - Poly = 0x80f * - XorIn = 0x000 * - ReflectIn = False * - XorOut = 0x000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc12_3gpp.h" /** * Static table used for the table_driven implementation. */ static const crc12_t crc12_table[256] = { 0x000, 0x80f, 0x811, 0x01e, 0x82d, 0x022, 0x03c, 0x833, 0x855, 0x05a, 0x044, 0x84b, 0x078, 0x877, 0x869, 0x066, 0x8a5, 0x0aa, 0x0b4, 0x8bb, 0x088, 0x887, 0x899, 0x096, 0x0f0, 0x8ff, 0x8e1, 0x0ee, 0x8dd, 0x0d2, 0x0cc, 0x8c3, 0x945, 0x14a, 0x154, 0x95b, 0x168, 0x967, 0x979, 0x176, 0x110, 0x91f, 0x901, 0x10e, 0x93d, 0x132, 0x12c, 0x923, 0x1e0, 0x9ef, 0x9f1, 0x1fe, 0x9cd, 0x1c2, 0x1dc, 0x9d3, 0x9b5, 0x1ba, 0x1a4, 0x9ab, 0x198, 0x997, 0x989, 0x186, 0xa85, 0x28a, 0x294, 0xa9b, 0x2a8, 0xaa7, 0xab9, 0x2b6, 0x2d0, 0xadf, 0xac1, 0x2ce, 0xafd, 0x2f2, 0x2ec, 0xae3, 0x220, 0xa2f, 0xa31, 0x23e, 0xa0d, 0x202, 0x21c, 0xa13, 0xa75, 0x27a, 0x264, 0xa6b, 0x258, 0xa57, 0xa49, 0x246, 0x3c0, 0xbcf, 0xbd1, 0x3de, 0xbed, 0x3e2, 0x3fc, 0xbf3, 0xb95, 0x39a, 0x384, 0xb8b, 0x3b8, 0xbb7, 0xba9, 0x3a6, 0xb65, 0x36a, 0x374, 0xb7b, 0x348, 0xb47, 0xb59, 0x356, 0x330, 0xb3f, 0xb21, 0x32e, 0xb1d, 0x312, 0x30c, 0xb03, 0xd05, 0x50a, 0x514, 0xd1b, 0x528, 0xd27, 0xd39, 0x536, 0x550, 0xd5f, 0xd41, 0x54e, 0xd7d, 0x572, 0x56c, 0xd63, 0x5a0, 0xdaf, 0xdb1, 0x5be, 0xd8d, 0x582, 0x59c, 0xd93, 0xdf5, 0x5fa, 0x5e4, 0xdeb, 0x5d8, 0xdd7, 0xdc9, 0x5c6, 0x440, 0xc4f, 0xc51, 0x45e, 0xc6d, 0x462, 0x47c, 0xc73, 0xc15, 0x41a, 0x404, 0xc0b, 0x438, 0xc37, 0xc29, 0x426, 0xce5, 0x4ea, 0x4f4, 0xcfb, 0x4c8, 0xcc7, 0xcd9, 0x4d6, 0x4b0, 0xcbf, 0xca1, 0x4ae, 0xc9d, 0x492, 0x48c, 0xc83, 0x780, 0xf8f, 0xf91, 0x79e, 0xfad, 0x7a2, 0x7bc, 0xfb3, 0xfd5, 0x7da, 0x7c4, 0xfcb, 0x7f8, 0xff7, 0xfe9, 0x7e6, 0xf25, 0x72a, 0x734, 0xf3b, 0x708, 0xf07, 0xf19, 0x716, 0x770, 0xf7f, 0xf61, 0x76e, 0xf5d, 0x752, 0x74c, 0xf43, 0xec5, 0x6ca, 0x6d4, 0xedb, 0x6e8, 0xee7, 0xef9, 0x6f6, 0x690, 0xe9f, 0xe81, 0x68e, 0xebd, 0x6b2, 0x6ac, 0xea3, 0x660, 0xe6f, 0xe71, 0x67e, 0xe4d, 0x642, 0x65c, 0xe53, 0xe35, 0x63a, 0x624, 0xe2b, 0x618, 0xe17, 0xe09, 0x606 }; crc12_t crc_reflect(crc12_t data, size_t data_len) { unsigned int i; crc12_t ret = data & 0x01; for (i = 1; i < data_len; i++) { data >>= 1; ret = (ret << 1) | (data & 0x01); } return ret; } crc12_t crc12_3gpp_update(crc12_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 4) ^ *d) & 0xff; crc = (crc12_table[tbl_idx] ^ (crc << 8)) & 0xfff; d++; } return crc & 0xfff; } postmodern-digest-crc-4adf113/ext/digest/crc12_3gpp/crc12_3gpp.h000066400000000000000000000003061474611004500242720ustar00rootroot00000000000000#ifndef _CRC12_3GPP_H_ #define _CRC12_3GPP_H_ #include #include typedef uint16_t crc12_t; crc12_t crc12_3gpp_update(crc12_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc12_3gpp/crc12_3gpp_ext.c000066400000000000000000000014341474611004500251500ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc12_3gpp.h" VALUE Digest_CRC12_3GPP_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc12_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc12_3gpp_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc12_3gpp_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC12_3GPP = rb_const_get(mDigest, rb_intern("CRC12_3GPP")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC12_3GPP, "update"); rb_define_method(cCRC12_3GPP, "update", Digest_CRC12_3GPP_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc12_3gpp/extconf.rb000066400000000000000000000001601474611004500242470ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc12_3gpp_ext" postmodern-digest-crc-4adf113/ext/digest/crc15/000077500000000000000000000000001474611004500213315ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc15/crc15.c000066400000000000000000000055411474611004500224170ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:30:57 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 15 * - Poly = 0x4599 * - XorIn = 0x0000 * - ReflectIn = False * - XorOut = 0x0000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc15.h" /** * Static table used for the table_driven implementation. */ static const crc15_t crc15_table[256] = { 0x0000, 0x4599, 0x4eab, 0x0b32, 0x58cf, 0x1d56, 0x1664, 0x53fd, 0x7407, 0x319e, 0x3aac, 0x7f35, 0x2cc8, 0x6951, 0x6263, 0x27fa, 0x2d97, 0x680e, 0x633c, 0x26a5, 0x7558, 0x30c1, 0x3bf3, 0x7e6a, 0x5990, 0x1c09, 0x173b, 0x52a2, 0x015f, 0x44c6, 0x4ff4, 0x0a6d, 0x5b2e, 0x1eb7, 0x1585, 0x501c, 0x03e1, 0x4678, 0x4d4a, 0x08d3, 0x2f29, 0x6ab0, 0x6182, 0x241b, 0x77e6, 0x327f, 0x394d, 0x7cd4, 0x76b9, 0x3320, 0x3812, 0x7d8b, 0x2e76, 0x6bef, 0x60dd, 0x2544, 0x02be, 0x4727, 0x4c15, 0x098c, 0x5a71, 0x1fe8, 0x14da, 0x5143, 0x73c5, 0x365c, 0x3d6e, 0x78f7, 0x2b0a, 0x6e93, 0x65a1, 0x2038, 0x07c2, 0x425b, 0x4969, 0x0cf0, 0x5f0d, 0x1a94, 0x11a6, 0x543f, 0x5e52, 0x1bcb, 0x10f9, 0x5560, 0x069d, 0x4304, 0x4836, 0x0daf, 0x2a55, 0x6fcc, 0x64fe, 0x2167, 0x729a, 0x3703, 0x3c31, 0x79a8, 0x28eb, 0x6d72, 0x6640, 0x23d9, 0x7024, 0x35bd, 0x3e8f, 0x7b16, 0x5cec, 0x1975, 0x1247, 0x57de, 0x0423, 0x41ba, 0x4a88, 0x0f11, 0x057c, 0x40e5, 0x4bd7, 0x0e4e, 0x5db3, 0x182a, 0x1318, 0x5681, 0x717b, 0x34e2, 0x3fd0, 0x7a49, 0x29b4, 0x6c2d, 0x671f, 0x2286, 0x2213, 0x678a, 0x6cb8, 0x2921, 0x7adc, 0x3f45, 0x3477, 0x71ee, 0x5614, 0x138d, 0x18bf, 0x5d26, 0x0edb, 0x4b42, 0x4070, 0x05e9, 0x0f84, 0x4a1d, 0x412f, 0x04b6, 0x574b, 0x12d2, 0x19e0, 0x5c79, 0x7b83, 0x3e1a, 0x3528, 0x70b1, 0x234c, 0x66d5, 0x6de7, 0x287e, 0x793d, 0x3ca4, 0x3796, 0x720f, 0x21f2, 0x646b, 0x6f59, 0x2ac0, 0x0d3a, 0x48a3, 0x4391, 0x0608, 0x55f5, 0x106c, 0x1b5e, 0x5ec7, 0x54aa, 0x1133, 0x1a01, 0x5f98, 0x0c65, 0x49fc, 0x42ce, 0x0757, 0x20ad, 0x6534, 0x6e06, 0x2b9f, 0x7862, 0x3dfb, 0x36c9, 0x7350, 0x51d6, 0x144f, 0x1f7d, 0x5ae4, 0x0919, 0x4c80, 0x47b2, 0x022b, 0x25d1, 0x6048, 0x6b7a, 0x2ee3, 0x7d1e, 0x3887, 0x33b5, 0x762c, 0x7c41, 0x39d8, 0x32ea, 0x7773, 0x248e, 0x6117, 0x6a25, 0x2fbc, 0x0846, 0x4ddf, 0x46ed, 0x0374, 0x5089, 0x1510, 0x1e22, 0x5bbb, 0x0af8, 0x4f61, 0x4453, 0x01ca, 0x5237, 0x17ae, 0x1c9c, 0x5905, 0x7eff, 0x3b66, 0x3054, 0x75cd, 0x2630, 0x63a9, 0x689b, 0x2d02, 0x276f, 0x62f6, 0x69c4, 0x2c5d, 0x7fa0, 0x3a39, 0x310b, 0x7492, 0x5368, 0x16f1, 0x1dc3, 0x585a, 0x0ba7, 0x4e3e, 0x450c, 0x0095 }; crc15_t crc15_update(crc15_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 7) ^ *d) & 0xff; crc = (crc15_table[tbl_idx] ^ (crc << 8)) & 0x7fff; d++; } return crc & 0x7fff; } postmodern-digest-crc-4adf113/ext/digest/crc15/crc15.h000066400000000000000000000002671474611004500224240ustar00rootroot00000000000000#ifndef _CRC15_H_ #define _CRC15_H_ #include #include typedef uint16_t crc15_t; crc15_t crc15_update(crc15_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc15/crc15_ext.c000066400000000000000000000014171474611004500232750ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc15.h" VALUE Digest_CRC15_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc15_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc15_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc15_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC15 = rb_const_get(mDigest, rb_intern("CRC15")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC15, "update"); rb_define_method(cCRC15, "update", Digest_CRC15_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc15/extconf.rb000066400000000000000000000001531474611004500233230ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc15_ext" postmodern-digest-crc-4adf113/ext/digest/crc16/000077500000000000000000000000001474611004500213325ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16/crc16.c000066400000000000000000000054701474611004500224220ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:01:54 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x8005 * - XorIn = 0x0000 * - ReflectIn = True * - XorOut = 0x0000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc16.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc16_table[256] = { 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 }; crc16_t crc16_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc16_table[tbl_idx] ^ (crc >> 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16/crc16.h000066400000000000000000000002671474611004500224260ustar00rootroot00000000000000#ifndef _CRC16_H_ #define _CRC16_H_ #include #include typedef uint16_t crc16_t; crc16_t crc16_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16/crc16_ext.c000066400000000000000000000014171474611004500232770ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16.h" VALUE Digest_CRC16_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16 = rb_const_get(mDigest, rb_intern("CRC16")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16, "update"); rb_define_method(cCRC16, "update", Digest_CRC16_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16/extconf.rb000066400000000000000000000001531474611004500233240ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_ccitt/000077500000000000000000000000001474611004500225205ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_ccitt/crc16_ccitt.c000066400000000000000000000055311474611004500247740ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:04:06 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x1021 * - XorIn = 0x1d0f * - ReflectIn = False * - XorOut = 0x0000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc16_ccitt.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc16_ccitt_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; crc16_t crc16_ccitt_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 8) ^ *d) & 0xff; crc = (crc16_ccitt_table[tbl_idx] ^ (crc << 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_ccitt/crc16_ccitt.h000066400000000000000000000002421474611004500247730ustar00rootroot00000000000000#ifndef _CRC16_CCITT_H_ #define _CRC16_CCITT_H_ #include "../crc16/crc16.h" crc16_t crc16_ccitt_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_ccitt/crc16_ccitt_ext.c000066400000000000000000000014771474611004500256610ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_ccitt.h" VALUE Digest_CRC16CCITT_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_ccitt_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_ccitt_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16CCITT = rb_const_get(mDigest, rb_intern("CRC16CCITT")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16CCITT, "update"); rb_define_method(cCRC16CCITT, "update", Digest_CRC16CCITT_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_ccitt/extconf.rb000066400000000000000000000001611474611004500245110ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_ccitt_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_dnp/000077500000000000000000000000001474611004500221735ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_dnp/crc16_dnp.c000066400000000000000000000052551474611004500241250ustar00rootroot00000000000000#include "crc16_dnp.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc16_dnp_table[256] = { 0x0000, 0x365e, 0x6cbc, 0x5ae2, 0xd978, 0xef26, 0xb5c4, 0x839a, 0xff89, 0xc9d7, 0x9335, 0xa56b, 0x26f1, 0x10af, 0x4a4d, 0x7c13, 0xb26b, 0x8435, 0xded7, 0xe889, 0x6b13, 0x5d4d, 0x07af, 0x31f1, 0x4de2, 0x7bbc, 0x215e, 0x1700, 0x949a, 0xa2c4, 0xf826, 0xce78, 0x29af, 0x1ff1, 0x4513, 0x734d, 0xf0d7, 0xc689, 0x9c6b, 0xaa35, 0xd626, 0xe078, 0xba9a, 0x8cc4, 0x0f5e, 0x3900, 0x63e2, 0x55bc, 0x9bc4, 0xad9a, 0xf778, 0xc126, 0x42bc, 0x74e2, 0x2e00, 0x185e, 0x644d, 0x5213, 0x08f1, 0x3eaf, 0xbd35, 0x8b6b, 0xd189, 0xe7d7, 0x535e, 0x6500, 0x3fe2, 0x09bc, 0x8a26, 0xbc78, 0xe69a, 0xd0c4, 0xacd7, 0x9a89, 0xc06b, 0xf635, 0x75af, 0x43f1, 0x1913, 0x2f4d, 0xe135, 0xd76b, 0x8d89, 0xbbd7, 0x384d, 0x0e13, 0x54f1, 0x62af, 0x1ebc, 0x28e2, 0x7200, 0x445e, 0xc7c4, 0xf19a, 0xab78, 0x9d26, 0x7af1, 0x4caf, 0x164d, 0x2013, 0xa389, 0x95d7, 0xcf35, 0xf96b, 0x8578, 0xb326, 0xe9c4, 0xdf9a, 0x5c00, 0x6a5e, 0x30bc, 0x06e2, 0xc89a, 0xfec4, 0xa426, 0x9278, 0x11e2, 0x27bc, 0x7d5e, 0x4b00, 0x3713, 0x014d, 0x5baf, 0x6df1, 0xee6b, 0xd835, 0x82d7, 0xb489, 0xa6bc, 0x90e2, 0xca00, 0xfc5e, 0x7fc4, 0x499a, 0x1378, 0x2526, 0x5935, 0x6f6b, 0x3589, 0x03d7, 0x804d, 0xb613, 0xecf1, 0xdaaf, 0x14d7, 0x2289, 0x786b, 0x4e35, 0xcdaf, 0xfbf1, 0xa113, 0x974d, 0xeb5e, 0xdd00, 0x87e2, 0xb1bc, 0x3226, 0x0478, 0x5e9a, 0x68c4, 0x8f13, 0xb94d, 0xe3af, 0xd5f1, 0x566b, 0x6035, 0x3ad7, 0x0c89, 0x709a, 0x46c4, 0x1c26, 0x2a78, 0xa9e2, 0x9fbc, 0xc55e, 0xf300, 0x3d78, 0x0b26, 0x51c4, 0x679a, 0xe400, 0xd25e, 0x88bc, 0xbee2, 0xc2f1, 0xf4af, 0xae4d, 0x9813, 0x1b89, 0x2dd7, 0x7735, 0x416b, 0xf5e2, 0xc3bc, 0x995e, 0xaf00, 0x2c9a, 0x1ac4, 0x4026, 0x7678, 0x0a6b, 0x3c35, 0x66d7, 0x5089, 0xd313, 0xe54d, 0xbfaf, 0x89f1, 0x4789, 0x71d7, 0x2b35, 0x1d6b, 0x9ef1, 0xa8af, 0xf24d, 0xc413, 0xb800, 0x8e5e, 0xd4bc, 0xe2e2, 0x6178, 0x5726, 0x0dc4, 0x3b9a, 0xdc4d, 0xea13, 0xb0f1, 0x86af, 0x0535, 0x336b, 0x6989, 0x5fd7, 0x23c4, 0x159a, 0x4f78, 0x7926, 0xfabc, 0xcce2, 0x9600, 0xa05e, 0x6e26, 0x5878, 0x029a, 0x34c4, 0xb75e, 0x8100, 0xdbe2, 0xedbc, 0x91af, 0xa7f1, 0xfd13, 0xcb4d, 0x48d7, 0x7e89, 0x246b, 0x1235 }; crc16_t crc16_dnp_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc << 8) ^ crc16_dnp_table[tbl_idx]; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_dnp/crc16_dnp.h000066400000000000000000000002441474611004500241230ustar00rootroot00000000000000#ifndef _CRC16_GENIBUS_H_ #define _CRC16_GENIBUS_H_ #include "../crc16/crc16.h" crc16_t crc16_dnp_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_dnp/crc16_dnp_ext.c000066400000000000000000000014551474611004500250030ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_dnp.h" VALUE Digest_CRC16DNP_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_dnp_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_dnp_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16DNP = rb_const_get(mDigest, rb_intern("CRC16DNP")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16DNP, "update"); rb_define_method(cCRC16DNP, "update", Digest_CRC16DNP_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_dnp/extconf.rb000066400000000000000000000001571474611004500241710ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_dnp_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_genibus/000077500000000000000000000000001474611004500230465ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_genibus/crc16_genibus.c000066400000000000000000000055411474611004500256510ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:31:25 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x1021 * - XorIn = 0xffff * - ReflectIn = False * - XorOut = 0xffff * - ReflectOut = False * - Algorithm = table-driven */ #include "crc16_genibus.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc16_genibus_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; crc16_t crc16_genibus_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 8) ^ *d) & 0xff; crc = (crc16_genibus_table[tbl_idx] ^ (crc << 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_genibus/crc16_genibus.h000066400000000000000000000002501474611004500256460ustar00rootroot00000000000000#ifndef _CRC16_GENIBUS_H_ #define _CRC16_GENIBUS_H_ #include "../crc16/crc16.h" crc16_t crc16_genibus_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_genibus/crc16_genibus_ext.c000066400000000000000000000015211474611004500265230ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_genibus.h" VALUE Digest_CRC16Genibus_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_genibus_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_genibus_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16Genibus = rb_const_get(mDigest, rb_intern("CRC16Genibus")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16Genibus, "update"); rb_define_method(cCRC16Genibus, "update", Digest_CRC16Genibus_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_genibus/extconf.rb000066400000000000000000000001631474611004500250410ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_genibus_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_kermit/000077500000000000000000000000001474611004500227055ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_kermit/crc16_kermit.c000066400000000000000000000055021474611004500253440ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:31:50 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x1021 * - XorIn = 0x0000 * - ReflectIn = True * - XorOut = 0x0000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc16_kermit.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 }; crc16_t crc16_kermit_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc_table[tbl_idx] ^ (crc >> 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_kermit/crc16_kermit.h000066400000000000000000000002451474611004500253500ustar00rootroot00000000000000#ifndef _CRC16_KERMIT_H_ #define _CRC16_KERMIT_H_ #include "../crc16/crc16.h" crc16_t crc16_kermit_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_kermit/crc16_kermit_ext.c000066400000000000000000000015101474611004500262170ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_kermit.h" VALUE Digest_CRC16Kermit_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_kermit_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_kermit_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16Kermit = rb_const_get(mDigest, rb_intern("CRC16Kermit")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16Kermit, "update"); rb_define_method(cCRC16Kermit, "update", Digest_CRC16Kermit_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_kermit/extconf.rb000066400000000000000000000001621474611004500246770ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_kermit_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_modbus/000077500000000000000000000000001474611004500227035ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_modbus/crc16_modbus.c000066400000000000000000000055021474611004500253400ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:04:54 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x8005 * - XorIn = 0xffff * - ReflectIn = True * - XorOut = 0x0000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc16_modbus.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc_table[256] = { 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 }; crc16_t crc16_modbus_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc_table[tbl_idx] ^ (crc >> 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_modbus/crc16_modbus.h000066400000000000000000000002451474611004500253440ustar00rootroot00000000000000#ifndef _CRC16_MODBUS_H_ #define _CRC16_MODBUS_H_ #include "../crc16/crc16.h" crc16_t crc16_modbus_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_modbus/crc16_modbus_ext.c000066400000000000000000000014361474611004500262220ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_modbus.h" VALUE Digest_CRC16Modbus_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_modbus_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_modbus_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16Modbus = rb_const_get(mDigest, rb_intern("CRC16Modbus")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC16Modbus, "update", Digest_CRC16Modbus_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_modbus/extconf.rb000066400000000000000000000001621474611004500246750ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_modbus_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_usb/000077500000000000000000000000001474611004500222035ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_usb/crc16_usb.c000066400000000000000000000054741474611004500241500ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:05:41 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x8005 * - XorIn = 0xffff * - ReflectIn = True * - XorOut = 0xffff * - ReflectOut = True * - Algorithm = table-driven */ #include "crc16_usb.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc_table[256] = { 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 }; crc16_t crc16_usb_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc_table[tbl_idx] ^ (crc >> 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_usb/crc16_usb.h000066400000000000000000000002341474611004500241420ustar00rootroot00000000000000#ifndef _CRC16_USB_H_ #define _CRC16_USB_H_ #include "../crc16/crc16.h" crc16_t crc16_usb_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_usb/crc16_usb_ext.c000066400000000000000000000014061474611004500250170ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_usb.h" VALUE Digest_CRC16USB_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_usb_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_usb_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16USB = rb_const_get(mDigest, rb_intern("CRC16USB")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC16USB, "update", Digest_CRC16USB_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_usb/extconf.rb000066400000000000000000000001571474611004500242010ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_usb_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_x_25/000077500000000000000000000000001474611004500221675ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_x_25/crc16_x_25.c000066400000000000000000000054761474611004500241220ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:32:07 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x1021 * - XorIn = 0xffff * - ReflectIn = True * - XorOut = 0xffff * - ReflectOut = True * - Algorithm = table-driven */ #include "crc16_x_25.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 }; crc16_t crc16_x_25_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc_table[tbl_idx] ^ (crc >> 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_x_25/crc16_x_25.h000066400000000000000000000002371474611004500241150ustar00rootroot00000000000000#ifndef _CRC16_X_25_H_ #define _CRC16_X_25_H_ #include "../crc16/crc16.h" crc16_t crc16_x_25_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_x_25/crc16_x_25_ext.c000066400000000000000000000014111474611004500247630ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_x_25.h" VALUE Digest_CRC16X25_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_x_25_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_x_25_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16X25 = rb_const_get(mDigest, rb_intern("CRC16X25")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC16X25, "update", Digest_CRC16X25_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_x_25/extconf.rb000066400000000000000000000001601474611004500241570ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_x_25_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_xmodem/000077500000000000000000000000001474611004500227035ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_xmodem/crc16_xmodem.c000066400000000000000000000055351474611004500253460ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:06:05 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x1021 * - XorIn = 0x0000 * - ReflectIn = False * - XorOut = 0x0000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc16_xmodem.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc16_xmodem_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; crc16_t crc16_xmodem_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 8) ^ *d) & 0xff; crc = (crc16_xmodem_table[tbl_idx] ^ (crc << 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_xmodem/crc16_xmodem.h000066400000000000000000000002451474611004500253440ustar00rootroot00000000000000#ifndef _CRC16_XMODEM_H_ #define _CRC16_XMODEM_H_ #include "../crc16/crc16.h" crc16_t crc16_xmodem_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_xmodem/crc16_xmodem_ext.c000066400000000000000000000015101474611004500262130ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_xmodem.h" VALUE Digest_CRC16XModem_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_xmodem_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_xmodem_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16XModem = rb_const_get(mDigest, rb_intern("CRC16XModem")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16XModem, "update"); rb_define_method(cCRC16XModem, "update", Digest_CRC16XModem_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_xmodem/extconf.rb000066400000000000000000000001621474611004500246750ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_xmodem_ext" postmodern-digest-crc-4adf113/ext/digest/crc16_zmodem/000077500000000000000000000000001474611004500227055ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc16_zmodem/crc16_zmodem.c000066400000000000000000000055351474611004500253520ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:06:11 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 16 * - Poly = 0x1021 * - XorIn = 0x0000 * - ReflectIn = False * - XorOut = 0x0000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc16_zmodem.h" /** * Static table used for the table_driven implementation. */ static const crc16_t crc16_zmodem_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; crc16_t crc16_zmodem_update(crc16_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 8) ^ *d) & 0xff; crc = (crc16_zmodem_table[tbl_idx] ^ (crc << 8)) & 0xffff; d++; } return crc & 0xffff; } postmodern-digest-crc-4adf113/ext/digest/crc16_zmodem/crc16_zmodem.h000066400000000000000000000002451474611004500253500ustar00rootroot00000000000000#ifndef _CRC16_ZMODEM_H_ #define _CRC16_ZMODEM_H_ #include "../crc16/crc16.h" crc16_t crc16_zmodem_update(crc16_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc16_zmodem/crc16_zmodem_ext.c000066400000000000000000000015101474611004500262170ustar00rootroot00000000000000#include #include "../compat/ruby.h" #include "extconf.h" #include "crc16_zmodem.h" VALUE Digest_CRC16ZModem_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc16_t crc = NUM2USHORT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc16_zmodem_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, USHORT2NUM(crc)); return self; } void Init_crc16_zmodem_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC16ZModem = rb_const_get(mDigest, rb_intern("CRC16ZModem")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC16ZModem, "update"); rb_define_method(cCRC16ZModem, "update", Digest_CRC16ZModem_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc16_zmodem/extconf.rb000066400000000000000000000001621474611004500246770ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc16_zmodem_ext" postmodern-digest-crc-4adf113/ext/digest/crc24/000077500000000000000000000000001474611004500213315ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc24/crc24.c000066400000000000000000000065141474611004500224200ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:02:04 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 24 * - Poly = 0x864cfb * - XorIn = 0xb704ce * - ReflectIn = False * - XorOut = 0x000000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc24.h" /** * Static table used for the table_driven implementation. */ static const crc24_t crc24_table[256] = { 0x000000, 0x864cfb, 0x8ad50d, 0x0c99f6, 0x93e6e1, 0x15aa1a, 0x1933ec, 0x9f7f17, 0xa18139, 0x27cdc2, 0x2b5434, 0xad18cf, 0x3267d8, 0xb42b23, 0xb8b2d5, 0x3efe2e, 0xc54e89, 0x430272, 0x4f9b84, 0xc9d77f, 0x56a868, 0xd0e493, 0xdc7d65, 0x5a319e, 0x64cfb0, 0xe2834b, 0xee1abd, 0x685646, 0xf72951, 0x7165aa, 0x7dfc5c, 0xfbb0a7, 0x0cd1e9, 0x8a9d12, 0x8604e4, 0x00481f, 0x9f3708, 0x197bf3, 0x15e205, 0x93aefe, 0xad50d0, 0x2b1c2b, 0x2785dd, 0xa1c926, 0x3eb631, 0xb8faca, 0xb4633c, 0x322fc7, 0xc99f60, 0x4fd39b, 0x434a6d, 0xc50696, 0x5a7981, 0xdc357a, 0xd0ac8c, 0x56e077, 0x681e59, 0xee52a2, 0xe2cb54, 0x6487af, 0xfbf8b8, 0x7db443, 0x712db5, 0xf7614e, 0x19a3d2, 0x9fef29, 0x9376df, 0x153a24, 0x8a4533, 0x0c09c8, 0x00903e, 0x86dcc5, 0xb822eb, 0x3e6e10, 0x32f7e6, 0xb4bb1d, 0x2bc40a, 0xad88f1, 0xa11107, 0x275dfc, 0xdced5b, 0x5aa1a0, 0x563856, 0xd074ad, 0x4f0bba, 0xc94741, 0xc5deb7, 0x43924c, 0x7d6c62, 0xfb2099, 0xf7b96f, 0x71f594, 0xee8a83, 0x68c678, 0x645f8e, 0xe21375, 0x15723b, 0x933ec0, 0x9fa736, 0x19ebcd, 0x8694da, 0x00d821, 0x0c41d7, 0x8a0d2c, 0xb4f302, 0x32bff9, 0x3e260f, 0xb86af4, 0x2715e3, 0xa15918, 0xadc0ee, 0x2b8c15, 0xd03cb2, 0x567049, 0x5ae9bf, 0xdca544, 0x43da53, 0xc596a8, 0xc90f5e, 0x4f43a5, 0x71bd8b, 0xf7f170, 0xfb6886, 0x7d247d, 0xe25b6a, 0x641791, 0x688e67, 0xeec29c, 0x3347a4, 0xb50b5f, 0xb992a9, 0x3fde52, 0xa0a145, 0x26edbe, 0x2a7448, 0xac38b3, 0x92c69d, 0x148a66, 0x181390, 0x9e5f6b, 0x01207c, 0x876c87, 0x8bf571, 0x0db98a, 0xf6092d, 0x7045d6, 0x7cdc20, 0xfa90db, 0x65efcc, 0xe3a337, 0xef3ac1, 0x69763a, 0x578814, 0xd1c4ef, 0xdd5d19, 0x5b11e2, 0xc46ef5, 0x42220e, 0x4ebbf8, 0xc8f703, 0x3f964d, 0xb9dab6, 0xb54340, 0x330fbb, 0xac70ac, 0x2a3c57, 0x26a5a1, 0xa0e95a, 0x9e1774, 0x185b8f, 0x14c279, 0x928e82, 0x0df195, 0x8bbd6e, 0x872498, 0x016863, 0xfad8c4, 0x7c943f, 0x700dc9, 0xf64132, 0x693e25, 0xef72de, 0xe3eb28, 0x65a7d3, 0x5b59fd, 0xdd1506, 0xd18cf0, 0x57c00b, 0xc8bf1c, 0x4ef3e7, 0x426a11, 0xc426ea, 0x2ae476, 0xaca88d, 0xa0317b, 0x267d80, 0xb90297, 0x3f4e6c, 0x33d79a, 0xb59b61, 0x8b654f, 0x0d29b4, 0x01b042, 0x87fcb9, 0x1883ae, 0x9ecf55, 0x9256a3, 0x141a58, 0xefaaff, 0x69e604, 0x657ff2, 0xe33309, 0x7c4c1e, 0xfa00e5, 0xf69913, 0x70d5e8, 0x4e2bc6, 0xc8673d, 0xc4fecb, 0x42b230, 0xddcd27, 0x5b81dc, 0x57182a, 0xd154d1, 0x26359f, 0xa07964, 0xace092, 0x2aac69, 0xb5d37e, 0x339f85, 0x3f0673, 0xb94a88, 0x87b4a6, 0x01f85d, 0x0d61ab, 0x8b2d50, 0x145247, 0x921ebc, 0x9e874a, 0x18cbb1, 0xe37b16, 0x6537ed, 0x69ae1b, 0xefe2e0, 0x709df7, 0xf6d10c, 0xfa48fa, 0x7c0401, 0x42fa2f, 0xc4b6d4, 0xc82f22, 0x4e63d9, 0xd11cce, 0x575035, 0x5bc9c3, 0xdd8538 }; crc24_t crc24_update(crc24_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 16) ^ *d) & 0xff; crc = (crc24_table[tbl_idx] ^ (crc << 8)) & 0xffffff; d++; } return crc & 0xffffff; } postmodern-digest-crc-4adf113/ext/digest/crc24/crc24.h000066400000000000000000000002671474611004500224240ustar00rootroot00000000000000#ifndef _CRC24_H_ #define _CRC24_H_ #include #include typedef uint32_t crc24_t; crc24_t crc24_update(crc24_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc24/crc24_ext.c000066400000000000000000000013571474611004500233000ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc24.h" VALUE Digest_CRC24_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc24_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc24_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc24_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC24 = rb_const_get(mDigest, rb_intern("CRC24")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC24, "update"); rb_define_method(cCRC24, "update", Digest_CRC24_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc24/extconf.rb000066400000000000000000000001531474611004500233230ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc24_ext" postmodern-digest-crc-4adf113/ext/digest/crc32/000077500000000000000000000000001474611004500213305ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32/crc32.c000066400000000000000000000075131474611004500224160ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 06:06:44 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x04c11db7 * - XorIn = 0xffffffff * - ReflectIn = True * - XorOut = 0xffffffff * - ReflectOut = True * - Algorithm = table-driven */ #include "crc32.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32_table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; crc32_t crc32_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc32_table[tbl_idx] ^ (crc >> 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32/crc32.h000066400000000000000000000002671474611004500224220ustar00rootroot00000000000000#ifndef _CRC32_H_ #define _CRC32_H_ #include #include typedef uint32_t crc32_t; crc32_t crc32_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32/crc32_ext.c000066400000000000000000000013571474611004500232760ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32.h" VALUE Digest_CRC32_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32 = rb_const_get(mDigest, rb_intern("CRC32")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC32, "update"); rb_define_method(cCRC32, "update", Digest_CRC32_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32/extconf.rb000066400000000000000000000001531474611004500233220ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32_ext" postmodern-digest-crc-4adf113/ext/digest/crc32_bzip2/000077500000000000000000000000001474611004500224365ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32_bzip2/crc32_bzip2.c000066400000000000000000000075561474611004500246410ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:08:13 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x04c11db7 * - XorIn = 0xffffffff * - ReflectIn = False * - XorOut = 0xffffffff * - ReflectOut = False * - Algorithm = table-driven */ #include "crc32_bzip2.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32_bzip2_table[256] = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; crc32_t crc32_bzip2_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 24) ^ *d) & 0xff; crc = (crc32_bzip2_table[tbl_idx] ^ (crc << 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32_bzip2/crc32_bzip2.h000066400000000000000000000002421474611004500246270ustar00rootroot00000000000000#ifndef _CRC32_BZIP2_H_ #define _CRC32_BZIP2_H_ #include "../crc32/crc32.h" crc32_t crc32_bzip2_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32_bzip2/crc32_bzip2_ext.c000066400000000000000000000014371474611004500255110ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32_bzip2.h" VALUE Digest_CRC32Bzip2_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_bzip2_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_bzip2_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32Bzip2 = rb_const_get(mDigest, rb_intern("CRC32BZip2")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC32Bzip2, "update"); rb_define_method(cCRC32Bzip2, "update", Digest_CRC32Bzip2_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32_bzip2/extconf.rb000066400000000000000000000001611474611004500244270ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32_bzip2_ext" postmodern-digest-crc-4adf113/ext/digest/crc32_jam/000077500000000000000000000000001474611004500221575ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32_jam/crc32_jam.c000066400000000000000000000075231474611004500240750ustar00rootroot00000000000000/* * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:33:07 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x04c11db7 * - XorIn = 0xffffffff * - ReflectIn = True * - XorOut = 0x00000000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc32_jam.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32_table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; crc32_t crc32_jam_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc32_table[tbl_idx] ^ (crc >> 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32_jam/crc32_jam.h000066400000000000000000000002341474611004500240720ustar00rootroot00000000000000#ifndef _CRC32_JAM_H_ #define _CRC32_JAM_H_ #include "../crc32/crc32.h" crc32_t crc32_jam_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32_jam/crc32_jam_ext.c000066400000000000000000000013461474611004500247520ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32_jam.h" VALUE Digest_CRC32Jam_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_jam_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_jam_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32Jam = rb_const_get(mDigest, rb_intern("CRC32Jam")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC32Jam, "update", Digest_CRC32Jam_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32_jam/extconf.rb000066400000000000000000000001571474611004500241550ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32_jam_ext" postmodern-digest-crc-4adf113/ext/digest/crc32_mpeg/000077500000000000000000000000001474611004500223405ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32_mpeg/crc32_mpeg.c000066400000000000000000000075521474611004500244410ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:06:59 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x04c11db7 * - XorIn = 0xffffffff * - ReflectIn = False * - XorOut = 0x00000000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc32_mpeg.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32_mpeg_table[256] = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; crc32_t crc32_mpeg_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 24) ^ *d) & 0xff; crc = (crc32_mpeg_table[tbl_idx] ^ (crc << 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32_mpeg/crc32_mpeg.h000066400000000000000000000002371474611004500244370ustar00rootroot00000000000000#ifndef _CRC32_MPEG_H_ #define _CRC32_MPEG_H_ #include "../crc32/crc32.h" crc32_t crc32_mpeg_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32_mpeg/crc32_mpeg_ext.c000066400000000000000000000014261474611004500253130ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32_mpeg.h" VALUE Digest_CRC32MPEG_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_mpeg_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_mpeg_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32MPEG = rb_const_get(mDigest, rb_intern("CRC32MPEG")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC32MPEG, "update"); rb_define_method(cCRC32MPEG, "update", Digest_CRC32MPEG_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32_mpeg/extconf.rb000066400000000000000000000001601474611004500243300ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32_mpeg_ext" postmodern-digest-crc-4adf113/ext/digest/crc32_posix/000077500000000000000000000000001474611004500225525ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32_posix/crc32_posix.c000066400000000000000000000075561474611004500250710ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:32:59 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x04c11db7 * - XorIn = 0x00000000 * - ReflectIn = False * - XorOut = 0xffffffff * - ReflectOut = False * - Algorithm = table-driven */ #include "crc32_posix.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32_posix_table[256] = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; crc32_t crc32_posix_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 24) ^ *d) & 0xff; crc = (crc32_posix_table[tbl_idx] ^ (crc << 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32_posix/crc32_posix.h000066400000000000000000000002421474611004500250570ustar00rootroot00000000000000#ifndef _CRC32_POSIX_H_ #define _CRC32_POSIX_H_ #include "../crc32/crc32.h" crc32_t crc32_posix_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32_posix/crc32_posix_ext.c000066400000000000000000000014371474611004500257410ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32_posix.h" VALUE Digest_CRC32POSIX_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_posix_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_posix_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32POSIX = rb_const_get(mDigest, rb_intern("CRC32POSIX")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC32POSIX, "update"); rb_define_method(cCRC32POSIX, "update", Digest_CRC32POSIX_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32_posix/extconf.rb000066400000000000000000000001611474611004500245430ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32_posix_ext" postmodern-digest-crc-4adf113/ext/digest/crc32_xfer/000077500000000000000000000000001474611004500223545ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32_xfer/crc32_xfer.c000066400000000000000000000075521474611004500244710ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:33:18 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x000000af * - XorIn = 0x00000000 * - ReflectIn = False * - XorOut = 0x00000000 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc32_xfer.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32_xfer_table[256] = { 0x00000000, 0x000000af, 0x0000015e, 0x000001f1, 0x000002bc, 0x00000213, 0x000003e2, 0x0000034d, 0x00000578, 0x000005d7, 0x00000426, 0x00000489, 0x000007c4, 0x0000076b, 0x0000069a, 0x00000635, 0x00000af0, 0x00000a5f, 0x00000bae, 0x00000b01, 0x0000084c, 0x000008e3, 0x00000912, 0x000009bd, 0x00000f88, 0x00000f27, 0x00000ed6, 0x00000e79, 0x00000d34, 0x00000d9b, 0x00000c6a, 0x00000cc5, 0x000015e0, 0x0000154f, 0x000014be, 0x00001411, 0x0000175c, 0x000017f3, 0x00001602, 0x000016ad, 0x00001098, 0x00001037, 0x000011c6, 0x00001169, 0x00001224, 0x0000128b, 0x0000137a, 0x000013d5, 0x00001f10, 0x00001fbf, 0x00001e4e, 0x00001ee1, 0x00001dac, 0x00001d03, 0x00001cf2, 0x00001c5d, 0x00001a68, 0x00001ac7, 0x00001b36, 0x00001b99, 0x000018d4, 0x0000187b, 0x0000198a, 0x00001925, 0x00002bc0, 0x00002b6f, 0x00002a9e, 0x00002a31, 0x0000297c, 0x000029d3, 0x00002822, 0x0000288d, 0x00002eb8, 0x00002e17, 0x00002fe6, 0x00002f49, 0x00002c04, 0x00002cab, 0x00002d5a, 0x00002df5, 0x00002130, 0x0000219f, 0x0000206e, 0x000020c1, 0x0000238c, 0x00002323, 0x000022d2, 0x0000227d, 0x00002448, 0x000024e7, 0x00002516, 0x000025b9, 0x000026f4, 0x0000265b, 0x000027aa, 0x00002705, 0x00003e20, 0x00003e8f, 0x00003f7e, 0x00003fd1, 0x00003c9c, 0x00003c33, 0x00003dc2, 0x00003d6d, 0x00003b58, 0x00003bf7, 0x00003a06, 0x00003aa9, 0x000039e4, 0x0000394b, 0x000038ba, 0x00003815, 0x000034d0, 0x0000347f, 0x0000358e, 0x00003521, 0x0000366c, 0x000036c3, 0x00003732, 0x0000379d, 0x000031a8, 0x00003107, 0x000030f6, 0x00003059, 0x00003314, 0x000033bb, 0x0000324a, 0x000032e5, 0x00005780, 0x0000572f, 0x000056de, 0x00005671, 0x0000553c, 0x00005593, 0x00005462, 0x000054cd, 0x000052f8, 0x00005257, 0x000053a6, 0x00005309, 0x00005044, 0x000050eb, 0x0000511a, 0x000051b5, 0x00005d70, 0x00005ddf, 0x00005c2e, 0x00005c81, 0x00005fcc, 0x00005f63, 0x00005e92, 0x00005e3d, 0x00005808, 0x000058a7, 0x00005956, 0x000059f9, 0x00005ab4, 0x00005a1b, 0x00005bea, 0x00005b45, 0x00004260, 0x000042cf, 0x0000433e, 0x00004391, 0x000040dc, 0x00004073, 0x00004182, 0x0000412d, 0x00004718, 0x000047b7, 0x00004646, 0x000046e9, 0x000045a4, 0x0000450b, 0x000044fa, 0x00004455, 0x00004890, 0x0000483f, 0x000049ce, 0x00004961, 0x00004a2c, 0x00004a83, 0x00004b72, 0x00004bdd, 0x00004de8, 0x00004d47, 0x00004cb6, 0x00004c19, 0x00004f54, 0x00004ffb, 0x00004e0a, 0x00004ea5, 0x00007c40, 0x00007cef, 0x00007d1e, 0x00007db1, 0x00007efc, 0x00007e53, 0x00007fa2, 0x00007f0d, 0x00007938, 0x00007997, 0x00007866, 0x000078c9, 0x00007b84, 0x00007b2b, 0x00007ada, 0x00007a75, 0x000076b0, 0x0000761f, 0x000077ee, 0x00007741, 0x0000740c, 0x000074a3, 0x00007552, 0x000075fd, 0x000073c8, 0x00007367, 0x00007296, 0x00007239, 0x00007174, 0x000071db, 0x0000702a, 0x00007085, 0x000069a0, 0x0000690f, 0x000068fe, 0x00006851, 0x00006b1c, 0x00006bb3, 0x00006a42, 0x00006aed, 0x00006cd8, 0x00006c77, 0x00006d86, 0x00006d29, 0x00006e64, 0x00006ecb, 0x00006f3a, 0x00006f95, 0x00006350, 0x000063ff, 0x0000620e, 0x000062a1, 0x000061ec, 0x00006143, 0x000060b2, 0x0000601d, 0x00006628, 0x00006687, 0x00006776, 0x000067d9, 0x00006494, 0x0000643b, 0x000065ca, 0x00006565 }; crc32_t crc32_xfer_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = ((crc >> 24) ^ *d) & 0xff; crc = (crc32_xfer_table[tbl_idx] ^ (crc << 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32_xfer/crc32_xfer.h000066400000000000000000000002371474611004500244670ustar00rootroot00000000000000#ifndef _CRC32_XFER_H_ #define _CRC32_XFER_H_ #include "../crc32/crc32.h" crc32_t crc32_xfer_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32_xfer/crc32_xfer_ext.c000066400000000000000000000014261474611004500253430ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32_xfer.h" VALUE Digest_CRC32XFER_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32_xfer_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32_xfer_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32XFER = rb_const_get(mDigest, rb_intern("CRC32XFER")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC32XFER, "update"); rb_define_method(cCRC32XFER, "update", Digest_CRC32XFER_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32_xfer/extconf.rb000066400000000000000000000001601474611004500243440ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32_xfer_ext" postmodern-digest-crc-4adf113/ext/digest/crc32c/000077500000000000000000000000001474611004500214735ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc32c/crc32c.c000066400000000000000000000075201474611004500227220ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:07:24 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 32 * - Poly = 0x1edc6f41 * - XorIn = 0xffffffff * - ReflectIn = True * - XorOut = 0xffffffff * - ReflectOut = True * - Algorithm = table-driven */ #include "crc32c.h" /** * Static table used for the table_driven implementation. */ static const crc32_t crc32c_table[256] = { 0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b, 0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b, 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384, 0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b, 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a, 0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5, 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa, 0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a, 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a, 0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48, 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957, 0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198, 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927, 0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8, 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7, 0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789, 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859, 0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9, 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6, 0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829, 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c, 0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043, 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c, 0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc, 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c, 0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652, 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d, 0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982, 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d, 0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2, 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed, 0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f, 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff, 0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f, 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540, 0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f, 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee, 0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321, 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e, 0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e, 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e, 0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351 }; crc32_t crc32c_update(crc32_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc32c_table[tbl_idx] ^ (crc >> 8)) & 0xffffffff; d++; } return crc & 0xffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc32c/crc32c.h000066400000000000000000000002231474611004500227200ustar00rootroot00000000000000#ifndef _CRC32C_H_ #define _CRC32C_H_ #include "../crc32/crc32.h" crc32_t crc32c_update(crc32_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc32c/crc32c_ext.c000066400000000000000000000013231474611004500235750ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc32c.h" VALUE Digest_CRC32c_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc32_t crc = NUM2UINT(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc32c_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc32c_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC32c = rb_const_get(mDigest, rb_intern("CRC32c")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC32c, "update", Digest_CRC32c_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc32c/extconf.rb000066400000000000000000000001541474611004500234660ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc32c_ext" postmodern-digest-crc-4adf113/ext/digest/crc5/000077500000000000000000000000001474611004500212505ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc5/crc5.c000066400000000000000000000044151474611004500222540ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:29:44 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 5 * - Poly = 0x05 * - XorIn = 0x1f * - ReflectIn = True * - XorOut = 0x1f * - ReflectOut = True * - Algorithm = table-driven */ #include "crc5.h" /** * Static table used for the table_driven implementation. */ static const crc5_t crc5_table[256] = { 0x00, 0x0e, 0x1c, 0x12, 0x11, 0x1f, 0x0d, 0x03, 0x0b, 0x05, 0x17, 0x19, 0x1a, 0x14, 0x06, 0x08, 0x16, 0x18, 0x0a, 0x04, 0x07, 0x09, 0x1b, 0x15, 0x1d, 0x13, 0x01, 0x0f, 0x0c, 0x02, 0x10, 0x1e, 0x05, 0x0b, 0x19, 0x17, 0x14, 0x1a, 0x08, 0x06, 0x0e, 0x00, 0x12, 0x1c, 0x1f, 0x11, 0x03, 0x0d, 0x13, 0x1d, 0x0f, 0x01, 0x02, 0x0c, 0x1e, 0x10, 0x18, 0x16, 0x04, 0x0a, 0x09, 0x07, 0x15, 0x1b, 0x0a, 0x04, 0x16, 0x18, 0x1b, 0x15, 0x07, 0x09, 0x01, 0x0f, 0x1d, 0x13, 0x10, 0x1e, 0x0c, 0x02, 0x1c, 0x12, 0x00, 0x0e, 0x0d, 0x03, 0x11, 0x1f, 0x17, 0x19, 0x0b, 0x05, 0x06, 0x08, 0x1a, 0x14, 0x0f, 0x01, 0x13, 0x1d, 0x1e, 0x10, 0x02, 0x0c, 0x04, 0x0a, 0x18, 0x16, 0x15, 0x1b, 0x09, 0x07, 0x19, 0x17, 0x05, 0x0b, 0x08, 0x06, 0x14, 0x1a, 0x12, 0x1c, 0x0e, 0x00, 0x03, 0x0d, 0x1f, 0x11, 0x14, 0x1a, 0x08, 0x06, 0x05, 0x0b, 0x19, 0x17, 0x1f, 0x11, 0x03, 0x0d, 0x0e, 0x00, 0x12, 0x1c, 0x02, 0x0c, 0x1e, 0x10, 0x13, 0x1d, 0x0f, 0x01, 0x09, 0x07, 0x15, 0x1b, 0x18, 0x16, 0x04, 0x0a, 0x11, 0x1f, 0x0d, 0x03, 0x00, 0x0e, 0x1c, 0x12, 0x1a, 0x14, 0x06, 0x08, 0x0b, 0x05, 0x17, 0x19, 0x07, 0x09, 0x1b, 0x15, 0x16, 0x18, 0x0a, 0x04, 0x0c, 0x02, 0x10, 0x1e, 0x1d, 0x13, 0x01, 0x0f, 0x1e, 0x10, 0x02, 0x0c, 0x0f, 0x01, 0x13, 0x1d, 0x15, 0x1b, 0x09, 0x07, 0x04, 0x0a, 0x18, 0x16, 0x08, 0x06, 0x14, 0x1a, 0x19, 0x17, 0x05, 0x0b, 0x03, 0x0d, 0x1f, 0x11, 0x12, 0x1c, 0x0e, 0x00, 0x1b, 0x15, 0x07, 0x09, 0x0a, 0x04, 0x16, 0x18, 0x10, 0x1e, 0x0c, 0x02, 0x01, 0x0f, 0x1d, 0x13, 0x0d, 0x03, 0x11, 0x1f, 0x1c, 0x12, 0x00, 0x0e, 0x06, 0x08, 0x1a, 0x14, 0x17, 0x19, 0x0b, 0x05 }; crc5_t crc5_update(crc5_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = crc ^ *d; crc = (crc5_table[tbl_idx] ^ (crc >> 8)) & 0x1f; d++; } return crc & 0x1f; } postmodern-digest-crc-4adf113/ext/digest/crc5/crc5.h000066400000000000000000000002601474611004500222530ustar00rootroot00000000000000#ifndef _CRC5_H_ #define _CRC5_H_ #include #include typedef uint8_t crc5_t; crc5_t crc5_update(crc5_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc5/crc5_ext.c000066400000000000000000000013441474611004500231320ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc5.h" VALUE Digest_CRC5_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc5_t crc = NUM2CHR(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc5_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc5_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC5 = rb_const_get(mDigest, rb_intern("CRC5")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC5, "update"); rb_define_method(cCRC5, "update", Digest_CRC5_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc5/extconf.rb000066400000000000000000000001521474611004500232410ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc5_ext" postmodern-digest-crc-4adf113/ext/digest/crc64/000077500000000000000000000000001474611004500213355ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc64/crc64.c000066400000000000000000000136241474611004500224300ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:02:14 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 64 * - Poly = 0x000000000000001b * - XorIn = 0x0000000000000000 * - ReflectIn = True * - XorOut = 0x0000000000000000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc64.h" /** * Static table used for the table_driven implementation. */ static const crc64_t crc64_table[256] = { 0x0000000000000000, 0x01b0000000000000, 0x0360000000000000, 0x02d0000000000000, 0x06c0000000000000, 0x0770000000000000, 0x05a0000000000000, 0x0410000000000000, 0x0d80000000000000, 0x0c30000000000000, 0x0ee0000000000000, 0x0f50000000000000, 0x0b40000000000000, 0x0af0000000000000, 0x0820000000000000, 0x0990000000000000, 0x1b00000000000000, 0x1ab0000000000000, 0x1860000000000000, 0x19d0000000000000, 0x1dc0000000000000, 0x1c70000000000000, 0x1ea0000000000000, 0x1f10000000000000, 0x1680000000000000, 0x1730000000000000, 0x15e0000000000000, 0x1450000000000000, 0x1040000000000000, 0x11f0000000000000, 0x1320000000000000, 0x1290000000000000, 0x3600000000000000, 0x37b0000000000000, 0x3560000000000000, 0x34d0000000000000, 0x30c0000000000000, 0x3170000000000000, 0x33a0000000000000, 0x3210000000000000, 0x3b80000000000000, 0x3a30000000000000, 0x38e0000000000000, 0x3950000000000000, 0x3d40000000000000, 0x3cf0000000000000, 0x3e20000000000000, 0x3f90000000000000, 0x2d00000000000000, 0x2cb0000000000000, 0x2e60000000000000, 0x2fd0000000000000, 0x2bc0000000000000, 0x2a70000000000000, 0x28a0000000000000, 0x2910000000000000, 0x2080000000000000, 0x2130000000000000, 0x23e0000000000000, 0x2250000000000000, 0x2640000000000000, 0x27f0000000000000, 0x2520000000000000, 0x2490000000000000, 0x6c00000000000000, 0x6db0000000000000, 0x6f60000000000000, 0x6ed0000000000000, 0x6ac0000000000000, 0x6b70000000000000, 0x69a0000000000000, 0x6810000000000000, 0x6180000000000000, 0x6030000000000000, 0x62e0000000000000, 0x6350000000000000, 0x6740000000000000, 0x66f0000000000000, 0x6420000000000000, 0x6590000000000000, 0x7700000000000000, 0x76b0000000000000, 0x7460000000000000, 0x75d0000000000000, 0x71c0000000000000, 0x7070000000000000, 0x72a0000000000000, 0x7310000000000000, 0x7a80000000000000, 0x7b30000000000000, 0x79e0000000000000, 0x7850000000000000, 0x7c40000000000000, 0x7df0000000000000, 0x7f20000000000000, 0x7e90000000000000, 0x5a00000000000000, 0x5bb0000000000000, 0x5960000000000000, 0x58d0000000000000, 0x5cc0000000000000, 0x5d70000000000000, 0x5fa0000000000000, 0x5e10000000000000, 0x5780000000000000, 0x5630000000000000, 0x54e0000000000000, 0x5550000000000000, 0x5140000000000000, 0x50f0000000000000, 0x5220000000000000, 0x5390000000000000, 0x4100000000000000, 0x40b0000000000000, 0x4260000000000000, 0x43d0000000000000, 0x47c0000000000000, 0x4670000000000000, 0x44a0000000000000, 0x4510000000000000, 0x4c80000000000000, 0x4d30000000000000, 0x4fe0000000000000, 0x4e50000000000000, 0x4a40000000000000, 0x4bf0000000000000, 0x4920000000000000, 0x4890000000000000, 0xd800000000000000, 0xd9b0000000000000, 0xdb60000000000000, 0xdad0000000000000, 0xdec0000000000000, 0xdf70000000000000, 0xdda0000000000000, 0xdc10000000000000, 0xd580000000000000, 0xd430000000000000, 0xd6e0000000000000, 0xd750000000000000, 0xd340000000000000, 0xd2f0000000000000, 0xd020000000000000, 0xd190000000000000, 0xc300000000000000, 0xc2b0000000000000, 0xc060000000000000, 0xc1d0000000000000, 0xc5c0000000000000, 0xc470000000000000, 0xc6a0000000000000, 0xc710000000000000, 0xce80000000000000, 0xcf30000000000000, 0xcde0000000000000, 0xcc50000000000000, 0xc840000000000000, 0xc9f0000000000000, 0xcb20000000000000, 0xca90000000000000, 0xee00000000000000, 0xefb0000000000000, 0xed60000000000000, 0xecd0000000000000, 0xe8c0000000000000, 0xe970000000000000, 0xeba0000000000000, 0xea10000000000000, 0xe380000000000000, 0xe230000000000000, 0xe0e0000000000000, 0xe150000000000000, 0xe540000000000000, 0xe4f0000000000000, 0xe620000000000000, 0xe790000000000000, 0xf500000000000000, 0xf4b0000000000000, 0xf660000000000000, 0xf7d0000000000000, 0xf3c0000000000000, 0xf270000000000000, 0xf0a0000000000000, 0xf110000000000000, 0xf880000000000000, 0xf930000000000000, 0xfbe0000000000000, 0xfa50000000000000, 0xfe40000000000000, 0xfff0000000000000, 0xfd20000000000000, 0xfc90000000000000, 0xb400000000000000, 0xb5b0000000000000, 0xb760000000000000, 0xb6d0000000000000, 0xb2c0000000000000, 0xb370000000000000, 0xb1a0000000000000, 0xb010000000000000, 0xb980000000000000, 0xb830000000000000, 0xbae0000000000000, 0xbb50000000000000, 0xbf40000000000000, 0xbef0000000000000, 0xbc20000000000000, 0xbd90000000000000, 0xaf00000000000000, 0xaeb0000000000000, 0xac60000000000000, 0xadd0000000000000, 0xa9c0000000000000, 0xa870000000000000, 0xaaa0000000000000, 0xab10000000000000, 0xa280000000000000, 0xa330000000000000, 0xa1e0000000000000, 0xa050000000000000, 0xa440000000000000, 0xa5f0000000000000, 0xa720000000000000, 0xa690000000000000, 0x8200000000000000, 0x83b0000000000000, 0x8160000000000000, 0x80d0000000000000, 0x84c0000000000000, 0x8570000000000000, 0x87a0000000000000, 0x8610000000000000, 0x8f80000000000000, 0x8e30000000000000, 0x8ce0000000000000, 0x8d50000000000000, 0x8940000000000000, 0x88f0000000000000, 0x8a20000000000000, 0x8b90000000000000, 0x9900000000000000, 0x98b0000000000000, 0x9a60000000000000, 0x9bd0000000000000, 0x9fc0000000000000, 0x9e70000000000000, 0x9ca0000000000000, 0x9d10000000000000, 0x9480000000000000, 0x9530000000000000, 0x97e0000000000000, 0x9650000000000000, 0x9240000000000000, 0x93f0000000000000, 0x9120000000000000, 0x9090000000000000 }; crc64_t crc64_update(crc64_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc64_table[tbl_idx] ^ (crc >> 8)) & 0xffffffffffffffff; d++; } return crc & 0xffffffffffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc64/crc64.h000066400000000000000000000002671474611004500224340ustar00rootroot00000000000000#ifndef _CRC64_H_ #define _CRC64_H_ #include #include typedef uint64_t crc64_t; crc64_t crc64_update(crc64_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc64/crc64_ext.c000066400000000000000000000013611474611004500233030ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc64.h" VALUE Digest_CRC64_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc64_t crc = NUM2ULONG(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc64_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, ULONG2NUM(crc)); return self; } void Init_crc64_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC64 = rb_const_get(mDigest, rb_intern("CRC64")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC64, "update"); rb_define_method(cCRC64, "update", Digest_CRC64_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc64/extconf.rb000066400000000000000000000001531474611004500233270ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc64_ext" postmodern-digest-crc-4adf113/ext/digest/crc64_jones/000077500000000000000000000000001474611004500225335ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc64_jones/crc64_jones.c000066400000000000000000000136401474611004500250220ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:33:28 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 64 * - Poly = 0xad93d23594c935a9 * - XorIn = 0xffffffffffffffff * - ReflectIn = True * - XorOut = 0x0000000000000000 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc64_jones.h" /** * Static table used for the table_driven implementation. */ static const crc64_t crc64_table[256] = { 0x0000000000000000, 0x7ad870c830358979, 0xf5b0e190606b12f2, 0x8f689158505e9b8b, 0xc038e5739841b68f, 0xbae095bba8743ff6, 0x358804e3f82aa47d, 0x4f50742bc81f2d04, 0xab28ecb46814fe75, 0xd1f09c7c5821770c, 0x5e980d24087fec87, 0x24407dec384a65fe, 0x6b1009c7f05548fa, 0x11c8790fc060c183, 0x9ea0e857903e5a08, 0xe478989fa00bd371, 0x7d08ff3b88be6f81, 0x07d08ff3b88be6f8, 0x88b81eabe8d57d73, 0xf2606e63d8e0f40a, 0xbd301a4810ffd90e, 0xc7e86a8020ca5077, 0x4880fbd87094cbfc, 0x32588b1040a14285, 0xd620138fe0aa91f4, 0xacf86347d09f188d, 0x2390f21f80c18306, 0x594882d7b0f40a7f, 0x1618f6fc78eb277b, 0x6cc0863448deae02, 0xe3a8176c18803589, 0x997067a428b5bcf0, 0xfa11fe77117cdf02, 0x80c98ebf2149567b, 0x0fa11fe77117cdf0, 0x75796f2f41224489, 0x3a291b04893d698d, 0x40f16bccb908e0f4, 0xcf99fa94e9567b7f, 0xb5418a5cd963f206, 0x513912c379682177, 0x2be1620b495da80e, 0xa489f35319033385, 0xde51839b2936bafc, 0x9101f7b0e12997f8, 0xebd98778d11c1e81, 0x64b116208142850a, 0x1e6966e8b1770c73, 0x8719014c99c2b083, 0xfdc17184a9f739fa, 0x72a9e0dcf9a9a271, 0x08719014c99c2b08, 0x4721e43f0183060c, 0x3df994f731b68f75, 0xb29105af61e814fe, 0xc849756751dd9d87, 0x2c31edf8f1d64ef6, 0x56e99d30c1e3c78f, 0xd9810c6891bd5c04, 0xa3597ca0a188d57d, 0xec09088b6997f879, 0x96d1784359a27100, 0x19b9e91b09fcea8b, 0x636199d339c963f2, 0xdf7adabd7a6e2d6f, 0xa5a2aa754a5ba416, 0x2aca3b2d1a053f9d, 0x50124be52a30b6e4, 0x1f423fcee22f9be0, 0x659a4f06d21a1299, 0xeaf2de5e82448912, 0x902aae96b271006b, 0x74523609127ad31a, 0x0e8a46c1224f5a63, 0x81e2d7997211c1e8, 0xfb3aa75142244891, 0xb46ad37a8a3b6595, 0xceb2a3b2ba0eecec, 0x41da32eaea507767, 0x3b024222da65fe1e, 0xa2722586f2d042ee, 0xd8aa554ec2e5cb97, 0x57c2c41692bb501c, 0x2d1ab4dea28ed965, 0x624ac0f56a91f461, 0x1892b03d5aa47d18, 0x97fa21650afae693, 0xed2251ad3acf6fea, 0x095ac9329ac4bc9b, 0x7382b9faaaf135e2, 0xfcea28a2faafae69, 0x8632586aca9a2710, 0xc9622c4102850a14, 0xb3ba5c8932b0836d, 0x3cd2cdd162ee18e6, 0x460abd1952db919f, 0x256b24ca6b12f26d, 0x5fb354025b277b14, 0xd0dbc55a0b79e09f, 0xaa03b5923b4c69e6, 0xe553c1b9f35344e2, 0x9f8bb171c366cd9b, 0x10e3202993385610, 0x6a3b50e1a30ddf69, 0x8e43c87e03060c18, 0xf49bb8b633338561, 0x7bf329ee636d1eea, 0x012b592653589793, 0x4e7b2d0d9b47ba97, 0x34a35dc5ab7233ee, 0xbbcbcc9dfb2ca865, 0xc113bc55cb19211c, 0x5863dbf1e3ac9dec, 0x22bbab39d3991495, 0xadd33a6183c78f1e, 0xd70b4aa9b3f20667, 0x985b3e827bed2b63, 0xe2834e4a4bd8a21a, 0x6debdf121b863991, 0x1733afda2bb3b0e8, 0xf34b37458bb86399, 0x8993478dbb8deae0, 0x06fbd6d5ebd3716b, 0x7c23a61ddbe6f812, 0x3373d23613f9d516, 0x49aba2fe23cc5c6f, 0xc6c333a67392c7e4, 0xbc1b436e43a74e9d, 0x95ac9329ac4bc9b5, 0xef74e3e19c7e40cc, 0x601c72b9cc20db47, 0x1ac40271fc15523e, 0x5594765a340a7f3a, 0x2f4c0692043ff643, 0xa02497ca54616dc8, 0xdafce7026454e4b1, 0x3e847f9dc45f37c0, 0x445c0f55f46abeb9, 0xcb349e0da4342532, 0xb1eceec59401ac4b, 0xfebc9aee5c1e814f, 0x8464ea266c2b0836, 0x0b0c7b7e3c7593bd, 0x71d40bb60c401ac4, 0xe8a46c1224f5a634, 0x927c1cda14c02f4d, 0x1d148d82449eb4c6, 0x67ccfd4a74ab3dbf, 0x289c8961bcb410bb, 0x5244f9a98c8199c2, 0xdd2c68f1dcdf0249, 0xa7f41839ecea8b30, 0x438c80a64ce15841, 0x3954f06e7cd4d138, 0xb63c61362c8a4ab3, 0xcce411fe1cbfc3ca, 0x83b465d5d4a0eece, 0xf96c151de49567b7, 0x76048445b4cbfc3c, 0x0cdcf48d84fe7545, 0x6fbd6d5ebd3716b7, 0x15651d968d029fce, 0x9a0d8ccedd5c0445, 0xe0d5fc06ed698d3c, 0xaf85882d2576a038, 0xd55df8e515432941, 0x5a3569bd451db2ca, 0x20ed197575283bb3, 0xc49581ead523e8c2, 0xbe4df122e51661bb, 0x3125607ab548fa30, 0x4bfd10b2857d7349, 0x04ad64994d625e4d, 0x7e7514517d57d734, 0xf11d85092d094cbf, 0x8bc5f5c11d3cc5c6, 0x12b5926535897936, 0x686de2ad05bcf04f, 0xe70573f555e26bc4, 0x9ddd033d65d7e2bd, 0xd28d7716adc8cfb9, 0xa85507de9dfd46c0, 0x273d9686cda3dd4b, 0x5de5e64efd965432, 0xb99d7ed15d9d8743, 0xc3450e196da80e3a, 0x4c2d9f413df695b1, 0x36f5ef890dc31cc8, 0x79a59ba2c5dc31cc, 0x037deb6af5e9b8b5, 0x8c157a32a5b7233e, 0xf6cd0afa9582aa47, 0x4ad64994d625e4da, 0x300e395ce6106da3, 0xbf66a804b64ef628, 0xc5bed8cc867b7f51, 0x8aeeace74e645255, 0xf036dc2f7e51db2c, 0x7f5e4d772e0f40a7, 0x05863dbf1e3ac9de, 0xe1fea520be311aaf, 0x9b26d5e88e0493d6, 0x144e44b0de5a085d, 0x6e963478ee6f8124, 0x21c640532670ac20, 0x5b1e309b16452559, 0xd476a1c3461bbed2, 0xaeaed10b762e37ab, 0x37deb6af5e9b8b5b, 0x4d06c6676eae0222, 0xc26e573f3ef099a9, 0xb8b627f70ec510d0, 0xf7e653dcc6da3dd4, 0x8d3e2314f6efb4ad, 0x0256b24ca6b12f26, 0x788ec2849684a65f, 0x9cf65a1b368f752e, 0xe62e2ad306bafc57, 0x6946bb8b56e467dc, 0x139ecb4366d1eea5, 0x5ccebf68aecec3a1, 0x2616cfa09efb4ad8, 0xa97e5ef8cea5d153, 0xd3a62e30fe90582a, 0xb0c7b7e3c7593bd8, 0xca1fc72bf76cb2a1, 0x45775673a732292a, 0x3faf26bb9707a053, 0x70ff52905f188d57, 0x0a2722586f2d042e, 0x854fb3003f739fa5, 0xff97c3c80f4616dc, 0x1bef5b57af4dc5ad, 0x61372b9f9f784cd4, 0xee5fbac7cf26d75f, 0x9487ca0fff135e26, 0xdbd7be24370c7322, 0xa10fceec0739fa5b, 0x2e675fb4576761d0, 0x54bf2f7c6752e8a9, 0xcdcf48d84fe75459, 0xb71738107fd2dd20, 0x387fa9482f8c46ab, 0x42a7d9801fb9cfd2, 0x0df7adabd7a6e2d6, 0x772fdd63e7936baf, 0xf8474c3bb7cdf024, 0x829f3cf387f8795d, 0x66e7a46c27f3aa2c, 0x1c3fd4a417c62355, 0x935745fc4798b8de, 0xe98f353477ad31a7, 0xa6df411fbfb21ca3, 0xdc0731d78f8795da, 0x536fa08fdfd90e51, 0x29b7d047efec8728 }; crc64_t crc64_jones_update(crc64_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc64_table[tbl_idx] ^ (crc >> 8)) & 0xffffffffffffffff; d++; } return crc & 0xffffffffffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc64_jones/crc64_jones.h000066400000000000000000000002421474611004500250210ustar00rootroot00000000000000#ifndef _CRC64_JONES_H_ #define _CRC64_JONES_H_ #include "../crc64/crc64.h" crc64_t crc64_jones_update(crc64_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc64_jones/crc64_jones_ext.c000066400000000000000000000013701474611004500256770ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc64_jones.h" VALUE Digest_CRC64Jones_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc64_t crc = NUM2ULONG(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc64_jones_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, ULONG2NUM(crc)); return self; } void Init_crc64_jones_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC64Jones = rb_const_get(mDigest, rb_intern("CRC64Jones")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC64Jones, "update", Digest_CRC64Jones_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc64_jones/extconf.rb000066400000000000000000000001611474611004500245240ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc64_jones_ext" postmodern-digest-crc-4adf113/ext/digest/crc64_nvme/000077500000000000000000000000001474611004500223625ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc64_nvme/crc64_nvme.c000066400000000000000000000136371474611004500245060ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Mon Jan 6 09:50:24 2025 * by pycrc v0.10.0, https://pycrc.org * using the configuration: * - Width. = 64 * - Poly. = 0xad93d23594c93659 * - XorIn. = 0xffffffffffffffff * - ReflectIn = True * - XorOut. = 0xffffffffffffffff * - ReflectOut = True * - Algorithm = table-driven */ #include "crc64_nvme.h" /** * Static table used for the table_driven implementation. */ static const crc64_t crc64_table[256] = { 0x0000000000000000, 0x7f6ef0c830358979, 0xfedde190606b12f2, 0x81b31158505e9b8b, 0xc962e5739841b68f, 0xb60c15bba8743ff6, 0x37bf04e3f82aa47d, 0x48d1f42bc81f2d04, 0xa61cecb46814fe75, 0xd9721c7c5821770c, 0x58c10d24087fec87, 0x27affdec384a65fe, 0x6f7e09c7f05548fa, 0x1010f90fc060c183, 0x91a3e857903e5a08, 0xeecd189fa00bd371, 0x78e0ff3b88be6f81, 0x078e0ff3b88be6f8, 0x863d1eabe8d57d73, 0xf953ee63d8e0f40a, 0xb1821a4810ffd90e, 0xceecea8020ca5077, 0x4f5ffbd87094cbfc, 0x30310b1040a14285, 0xdefc138fe0aa91f4, 0xa192e347d09f188d, 0x2021f21f80c18306, 0x5f4f02d7b0f40a7f, 0x179ef6fc78eb277b, 0x68f0063448deae02, 0xe943176c18803589, 0x962de7a428b5bcf0, 0xf1c1fe77117cdf02, 0x8eaf0ebf2149567b, 0x0f1c1fe77117cdf0, 0x7072ef2f41224489, 0x38a31b04893d698d, 0x47cdebccb908e0f4, 0xc67efa94e9567b7f, 0xb9100a5cd963f206, 0x57dd12c379682177, 0x28b3e20b495da80e, 0xa900f35319033385, 0xd66e039b2936bafc, 0x9ebff7b0e12997f8, 0xe1d10778d11c1e81, 0x606216208142850a, 0x1f0ce6e8b1770c73, 0x8921014c99c2b083, 0xf64ff184a9f739fa, 0x77fce0dcf9a9a271, 0x08921014c99c2b08, 0x4043e43f0183060c, 0x3f2d14f731b68f75, 0xbe9e05af61e814fe, 0xc1f0f56751dd9d87, 0x2f3dedf8f1d64ef6, 0x50531d30c1e3c78f, 0xd1e00c6891bd5c04, 0xae8efca0a188d57d, 0xe65f088b6997f879, 0x9931f84359a27100, 0x1882e91b09fcea8b, 0x67ec19d339c963f2, 0xd75adabd7a6e2d6f, 0xa8342a754a5ba416, 0x29873b2d1a053f9d, 0x56e9cbe52a30b6e4, 0x1e383fcee22f9be0, 0x6156cf06d21a1299, 0xe0e5de5e82448912, 0x9f8b2e96b271006b, 0x71463609127ad31a, 0x0e28c6c1224f5a63, 0x8f9bd7997211c1e8, 0xf0f5275142244891, 0xb824d37a8a3b6595, 0xc74a23b2ba0eecec, 0x46f932eaea507767, 0x3997c222da65fe1e, 0xafba2586f2d042ee, 0xd0d4d54ec2e5cb97, 0x5167c41692bb501c, 0x2e0934dea28ed965, 0x66d8c0f56a91f461, 0x19b6303d5aa47d18, 0x980521650afae693, 0xe76bd1ad3acf6fea, 0x09a6c9329ac4bc9b, 0x76c839faaaf135e2, 0xf77b28a2faafae69, 0x8815d86aca9a2710, 0xc0c42c4102850a14, 0xbfaadc8932b0836d, 0x3e19cdd162ee18e6, 0x41773d1952db919f, 0x269b24ca6b12f26d, 0x59f5d4025b277b14, 0xd846c55a0b79e09f, 0xa72835923b4c69e6, 0xeff9c1b9f35344e2, 0x90973171c366cd9b, 0x1124202993385610, 0x6e4ad0e1a30ddf69, 0x8087c87e03060c18, 0xffe938b633338561, 0x7e5a29ee636d1eea, 0x0134d92653589793, 0x49e52d0d9b47ba97, 0x368bddc5ab7233ee, 0xb738cc9dfb2ca865, 0xc8563c55cb19211c, 0x5e7bdbf1e3ac9dec, 0x21152b39d3991495, 0xa0a63a6183c78f1e, 0xdfc8caa9b3f20667, 0x97193e827bed2b63, 0xe877ce4a4bd8a21a, 0x69c4df121b863991, 0x16aa2fda2bb3b0e8, 0xf86737458bb86399, 0x8709c78dbb8deae0, 0x06bad6d5ebd3716b, 0x79d4261ddbe6f812, 0x3105d23613f9d516, 0x4e6b22fe23cc5c6f, 0xcfd833a67392c7e4, 0xb0b6c36e43a74e9d, 0x9a6c9329ac4bc9b5, 0xe50263e19c7e40cc, 0x64b172b9cc20db47, 0x1bdf8271fc15523e, 0x530e765a340a7f3a, 0x2c608692043ff643, 0xadd397ca54616dc8, 0xd2bd67026454e4b1, 0x3c707f9dc45f37c0, 0x431e8f55f46abeb9, 0xc2ad9e0da4342532, 0xbdc36ec59401ac4b, 0xf5129aee5c1e814f, 0x8a7c6a266c2b0836, 0x0bcf7b7e3c7593bd, 0x74a18bb60c401ac4, 0xe28c6c1224f5a634, 0x9de29cda14c02f4d, 0x1c518d82449eb4c6, 0x633f7d4a74ab3dbf, 0x2bee8961bcb410bb, 0x548079a98c8199c2, 0xd53368f1dcdf0249, 0xaa5d9839ecea8b30, 0x449080a64ce15841, 0x3bfe706e7cd4d138, 0xba4d61362c8a4ab3, 0xc52391fe1cbfc3ca, 0x8df265d5d4a0eece, 0xf29c951de49567b7, 0x732f8445b4cbfc3c, 0x0c41748d84fe7545, 0x6bad6d5ebd3716b7, 0x14c39d968d029fce, 0x95708ccedd5c0445, 0xea1e7c06ed698d3c, 0xa2cf882d2576a038, 0xdda178e515432941, 0x5c1269bd451db2ca, 0x237c997575283bb3, 0xcdb181ead523e8c2, 0xb2df7122e51661bb, 0x336c607ab548fa30, 0x4c0290b2857d7349, 0x04d364994d625e4d, 0x7bbd94517d57d734, 0xfa0e85092d094cbf, 0x856075c11d3cc5c6, 0x134d926535897936, 0x6c2362ad05bcf04f, 0xed9073f555e26bc4, 0x92fe833d65d7e2bd, 0xda2f7716adc8cfb9, 0xa54187de9dfd46c0, 0x24f29686cda3dd4b, 0x5b9c664efd965432, 0xb5517ed15d9d8743, 0xca3f8e196da80e3a, 0x4b8c9f413df695b1, 0x34e26f890dc31cc8, 0x7c339ba2c5dc31cc, 0x035d6b6af5e9b8b5, 0x82ee7a32a5b7233e, 0xfd808afa9582aa47, 0x4d364994d625e4da, 0x3258b95ce6106da3, 0xb3eba804b64ef628, 0xcc8558cc867b7f51, 0x8454ace74e645255, 0xfb3a5c2f7e51db2c, 0x7a894d772e0f40a7, 0x05e7bdbf1e3ac9de, 0xeb2aa520be311aaf, 0x944455e88e0493d6, 0x15f744b0de5a085d, 0x6a99b478ee6f8124, 0x224840532670ac20, 0x5d26b09b16452559, 0xdc95a1c3461bbed2, 0xa3fb510b762e37ab, 0x35d6b6af5e9b8b5b, 0x4ab846676eae0222, 0xcb0b573f3ef099a9, 0xb465a7f70ec510d0, 0xfcb453dcc6da3dd4, 0x83daa314f6efb4ad, 0x0269b24ca6b12f26, 0x7d0742849684a65f, 0x93ca5a1b368f752e, 0xeca4aad306bafc57, 0x6d17bb8b56e467dc, 0x12794b4366d1eea5, 0x5aa8bf68aecec3a1, 0x25c64fa09efb4ad8, 0xa4755ef8cea5d153, 0xdb1bae30fe90582a, 0xbcf7b7e3c7593bd8, 0xc399472bf76cb2a1, 0x422a5673a732292a, 0x3d44a6bb9707a053, 0x759552905f188d57, 0x0afba2586f2d042e, 0x8b48b3003f739fa5, 0xf42643c80f4616dc, 0x1aeb5b57af4dc5ad, 0x6585ab9f9f784cd4, 0xe436bac7cf26d75f, 0x9b584a0fff135e26, 0xd389be24370c7322, 0xace74eec0739fa5b, 0x2d545fb4576761d0, 0x523aaf7c6752e8a9, 0xc41748d84fe75459, 0xbb79b8107fd2dd20, 0x3acaa9482f8c46ab, 0x45a459801fb9cfd2, 0x0d75adabd7a6e2d6, 0x721b5d63e7936baf, 0xf3a84c3bb7cdf024, 0x8cc6bcf387f8795d, 0x620ba46c27f3aa2c, 0x1d6554a417c62355, 0x9cd645fc4798b8de, 0xe3b8b53477ad31a7, 0xab69411fbfb21ca3, 0xd407b1d78f8795da, 0x55b4a08fdfd90e51, 0x2ada5047efec8728 }; crc64_t crc64_nvme_update(crc64_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc64_table[tbl_idx] ^ (crc >> 8)) & 0xffffffffffffffff; d++; } return crc & 0xffffffffffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc64_nvme/crc64_nvme.h000066400000000000000000000002371474611004500245030ustar00rootroot00000000000000#ifndef _CRC64_NVME_H_ #define _CRC64_NVME_H_ #include "../crc64/crc64.h" crc64_t crc64_nvme_update(crc64_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc64_nvme/crc64_nvme_ext.c000066400000000000000000000013601474611004500253540ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc64_nvme.h" VALUE Digest_CRC64NVMe_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc64_t crc = NUM2ULONG(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc64_nvme_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, ULONG2NUM(crc)); return self; } void Init_crc64_nvme_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC64NVMe = rb_const_get(mDigest, rb_intern("CRC64NVMe")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC64NVMe, "update", Digest_CRC64NVMe_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc64_nvme/extconf.rb000066400000000000000000000001601474611004500243520ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc64_nvme_ext" postmodern-digest-crc-4adf113/ext/digest/crc64_xz/000077500000000000000000000000001474611004500220565ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc64_xz/crc64_xz.c000066400000000000000000000136321474611004500236710ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:33:36 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 64 * - Poly = 0x42f0e1eba9ea3693 * - XorIn = 0xffffffffffffffff * - ReflectIn = True * - XorOut = 0xffffffffffffffff * - ReflectOut = True * - Algorithm = table-driven */ #include "crc64_xz.h" /** * Static table used for the table_driven implementation. */ static const crc64_t crc64_table[256] = { 0x0000000000000000, 0xb32e4cbe03a75f6f, 0xf4843657a840a05b, 0x47aa7ae9abe7ff34, 0x7bd0c384ff8f5e33, 0xc8fe8f3afc28015c, 0x8f54f5d357cffe68, 0x3c7ab96d5468a107, 0xf7a18709ff1ebc66, 0x448fcbb7fcb9e309, 0x0325b15e575e1c3d, 0xb00bfde054f94352, 0x8c71448d0091e255, 0x3f5f08330336bd3a, 0x78f572daa8d1420e, 0xcbdb3e64ab761d61, 0x7d9ba13851336649, 0xceb5ed8652943926, 0x891f976ff973c612, 0x3a31dbd1fad4997d, 0x064b62bcaebc387a, 0xb5652e02ad1b6715, 0xf2cf54eb06fc9821, 0x41e11855055bc74e, 0x8a3a2631ae2dda2f, 0x39146a8fad8a8540, 0x7ebe1066066d7a74, 0xcd905cd805ca251b, 0xf1eae5b551a2841c, 0x42c4a90b5205db73, 0x056ed3e2f9e22447, 0xb6409f5cfa457b28, 0xfb374270a266cc92, 0x48190ecea1c193fd, 0x0fb374270a266cc9, 0xbc9d3899098133a6, 0x80e781f45de992a1, 0x33c9cd4a5e4ecdce, 0x7463b7a3f5a932fa, 0xc74dfb1df60e6d95, 0x0c96c5795d7870f4, 0xbfb889c75edf2f9b, 0xf812f32ef538d0af, 0x4b3cbf90f69f8fc0, 0x774606fda2f72ec7, 0xc4684a43a15071a8, 0x83c230aa0ab78e9c, 0x30ec7c140910d1f3, 0x86ace348f355aadb, 0x3582aff6f0f2f5b4, 0x7228d51f5b150a80, 0xc10699a158b255ef, 0xfd7c20cc0cdaf4e8, 0x4e526c720f7dab87, 0x09f8169ba49a54b3, 0xbad65a25a73d0bdc, 0x710d64410c4b16bd, 0xc22328ff0fec49d2, 0x85895216a40bb6e6, 0x36a71ea8a7ace989, 0x0adda7c5f3c4488e, 0xb9f3eb7bf06317e1, 0xfe5991925b84e8d5, 0x4d77dd2c5823b7ba, 0x64b62bcaebc387a1, 0xd7986774e864d8ce, 0x90321d9d438327fa, 0x231c512340247895, 0x1f66e84e144cd992, 0xac48a4f017eb86fd, 0xebe2de19bc0c79c9, 0x58cc92a7bfab26a6, 0x9317acc314dd3bc7, 0x2039e07d177a64a8, 0x67939a94bc9d9b9c, 0xd4bdd62abf3ac4f3, 0xe8c76f47eb5265f4, 0x5be923f9e8f53a9b, 0x1c4359104312c5af, 0xaf6d15ae40b59ac0, 0x192d8af2baf0e1e8, 0xaa03c64cb957be87, 0xeda9bca512b041b3, 0x5e87f01b11171edc, 0x62fd4976457fbfdb, 0xd1d305c846d8e0b4, 0x96797f21ed3f1f80, 0x2557339fee9840ef, 0xee8c0dfb45ee5d8e, 0x5da24145464902e1, 0x1a083bacedaefdd5, 0xa9267712ee09a2ba, 0x955cce7fba6103bd, 0x267282c1b9c65cd2, 0x61d8f8281221a3e6, 0xd2f6b4961186fc89, 0x9f8169ba49a54b33, 0x2caf25044a02145c, 0x6b055fede1e5eb68, 0xd82b1353e242b407, 0xe451aa3eb62a1500, 0x577fe680b58d4a6f, 0x10d59c691e6ab55b, 0xa3fbd0d71dcdea34, 0x6820eeb3b6bbf755, 0xdb0ea20db51ca83a, 0x9ca4d8e41efb570e, 0x2f8a945a1d5c0861, 0x13f02d374934a966, 0xa0de61894a93f609, 0xe7741b60e174093d, 0x545a57dee2d35652, 0xe21ac88218962d7a, 0x5134843c1b317215, 0x169efed5b0d68d21, 0xa5b0b26bb371d24e, 0x99ca0b06e7197349, 0x2ae447b8e4be2c26, 0x6d4e3d514f59d312, 0xde6071ef4cfe8c7d, 0x15bb4f8be788911c, 0xa6950335e42fce73, 0xe13f79dc4fc83147, 0x521135624c6f6e28, 0x6e6b8c0f1807cf2f, 0xdd45c0b11ba09040, 0x9aefba58b0476f74, 0x29c1f6e6b3e0301b, 0xc96c5795d7870f42, 0x7a421b2bd420502d, 0x3de861c27fc7af19, 0x8ec62d7c7c60f076, 0xb2bc941128085171, 0x0192d8af2baf0e1e, 0x4638a2468048f12a, 0xf516eef883efae45, 0x3ecdd09c2899b324, 0x8de39c222b3eec4b, 0xca49e6cb80d9137f, 0x7967aa75837e4c10, 0x451d1318d716ed17, 0xf6335fa6d4b1b278, 0xb199254f7f564d4c, 0x02b769f17cf11223, 0xb4f7f6ad86b4690b, 0x07d9ba1385133664, 0x4073c0fa2ef4c950, 0xf35d8c442d53963f, 0xcf273529793b3738, 0x7c0979977a9c6857, 0x3ba3037ed17b9763, 0x888d4fc0d2dcc80c, 0x435671a479aad56d, 0xf0783d1a7a0d8a02, 0xb7d247f3d1ea7536, 0x04fc0b4dd24d2a59, 0x3886b22086258b5e, 0x8ba8fe9e8582d431, 0xcc0284772e652b05, 0x7f2cc8c92dc2746a, 0x325b15e575e1c3d0, 0x8175595b76469cbf, 0xc6df23b2dda1638b, 0x75f16f0cde063ce4, 0x498bd6618a6e9de3, 0xfaa59adf89c9c28c, 0xbd0fe036222e3db8, 0x0e21ac88218962d7, 0xc5fa92ec8aff7fb6, 0x76d4de52895820d9, 0x317ea4bb22bfdfed, 0x8250e80521188082, 0xbe2a516875702185, 0x0d041dd676d77eea, 0x4aae673fdd3081de, 0xf9802b81de97deb1, 0x4fc0b4dd24d2a599, 0xfceef8632775faf6, 0xbb44828a8c9205c2, 0x086ace348f355aad, 0x34107759db5dfbaa, 0x873e3be7d8faa4c5, 0xc094410e731d5bf1, 0x73ba0db070ba049e, 0xb86133d4dbcc19ff, 0x0b4f7f6ad86b4690, 0x4ce50583738cb9a4, 0xffcb493d702be6cb, 0xc3b1f050244347cc, 0x709fbcee27e418a3, 0x3735c6078c03e797, 0x841b8ab98fa4b8f8, 0xadda7c5f3c4488e3, 0x1ef430e13fe3d78c, 0x595e4a08940428b8, 0xea7006b697a377d7, 0xd60abfdbc3cbd6d0, 0x6524f365c06c89bf, 0x228e898c6b8b768b, 0x91a0c532682c29e4, 0x5a7bfb56c35a3485, 0xe955b7e8c0fd6bea, 0xaeffcd016b1a94de, 0x1dd181bf68bdcbb1, 0x21ab38d23cd56ab6, 0x9285746c3f7235d9, 0xd52f0e859495caed, 0x6601423b97329582, 0xd041dd676d77eeaa, 0x636f91d96ed0b1c5, 0x24c5eb30c5374ef1, 0x97eba78ec690119e, 0xab911ee392f8b099, 0x18bf525d915feff6, 0x5f1528b43ab810c2, 0xec3b640a391f4fad, 0x27e05a6e926952cc, 0x94ce16d091ce0da3, 0xd3646c393a29f297, 0x604a2087398eadf8, 0x5c3099ea6de60cff, 0xef1ed5546e415390, 0xa8b4afbdc5a6aca4, 0x1b9ae303c601f3cb, 0x56ed3e2f9e224471, 0xe5c372919d851b1e, 0xa26908783662e42a, 0x114744c635c5bb45, 0x2d3dfdab61ad1a42, 0x9e13b115620a452d, 0xd9b9cbfcc9edba19, 0x6a978742ca4ae576, 0xa14cb926613cf817, 0x1262f598629ba778, 0x55c88f71c97c584c, 0xe6e6c3cfcadb0723, 0xda9c7aa29eb3a624, 0x69b2361c9d14f94b, 0x2e184cf536f3067f, 0x9d36004b35545910, 0x2b769f17cf112238, 0x9858d3a9ccb67d57, 0xdff2a94067518263, 0x6cdce5fe64f6dd0c, 0x50a65c93309e7c0b, 0xe388102d33392364, 0xa4226ac498dedc50, 0x170c267a9b79833f, 0xdcd7181e300f9e5e, 0x6ff954a033a8c131, 0x28532e49984f3e05, 0x9b7d62f79be8616a, 0xa707db9acf80c06d, 0x14299724cc279f02, 0x5383edcd67c06036, 0xe0ada17364673f59 }; crc64_t crc64_xz_update(crc64_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = (crc ^ *d) & 0xff; crc = (crc64_table[tbl_idx] ^ (crc >> 8)) & 0xffffffffffffffff; d++; } return crc & 0xffffffffffffffff; } postmodern-digest-crc-4adf113/ext/digest/crc64_xz/crc64_xz.h000066400000000000000000000002311474611004500236650ustar00rootroot00000000000000#ifndef _CRC64_XZ_H_ #define _CRC64_XZ_H_ #include "../crc64/crc64.h" crc64_t crc64_xz_update(crc64_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc64_xz/crc64_xz_ext.c000066400000000000000000000013401474611004500245420ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc64_xz.h" VALUE Digest_CRC64XZ_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc64_t crc = NUM2ULONG(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc64_xz_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, ULONG2NUM(crc)); return self; } void Init_crc64_xz_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC64XZ = rb_const_get(mDigest, rb_intern("CRC64XZ")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC64XZ, "update", Digest_CRC64XZ_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc64_xz/extconf.rb000066400000000000000000000001561474611004500240530ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc64_xz_ext" postmodern-digest-crc-4adf113/ext/digest/crc8/000077500000000000000000000000001474611004500212535ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc8/crc8.c000066400000000000000000000044141474611004500222610ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:01:47 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 8 * - Poly = 0x07 * - XorIn = 0x00 * - ReflectIn = False * - XorOut = 0x00 * - ReflectOut = False * - Algorithm = table-driven */ #include "crc8.h" /** * Static table used for the table_driven implementation. */ static const crc8_t crc8_1wire_table[256] = { 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3 }; crc8_t crc8_update(crc8_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = crc ^ *d; crc = crc8_1wire_table[tbl_idx] & 0xff; d++; } return crc & 0xff; } postmodern-digest-crc-4adf113/ext/digest/crc8/crc8.h000066400000000000000000000002601474611004500222610ustar00rootroot00000000000000#ifndef _CRC8_H_ #define _CRC8_H_ #include #include typedef uint8_t crc8_t; crc8_t crc8_update(crc8_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc8/crc8_ext.c000066400000000000000000000013441474611004500231400ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc8.h" VALUE Digest_CRC8_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc8_t crc = NUM2CHR(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc8_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc8_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC8 = rb_const_get(mDigest, rb_intern("CRC8")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_undef_method(cCRC8, "update"); rb_define_method(cCRC8, "update", Digest_CRC8_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc8/extconf.rb000066400000000000000000000001521474611004500232440ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc8_ext" postmodern-digest-crc-4adf113/ext/digest/crc8_1wire/000077500000000000000000000000001474611004500223625ustar00rootroot00000000000000postmodern-digest-crc-4adf113/ext/digest/crc8_1wire/crc8_1wire.c000066400000000000000000000044311474611004500244760ustar00rootroot00000000000000/** * \file * Functions and types for CRC checks. * * Generated on Sat Feb 29 02:02:50 2020 * by pycrc v0.9.2, https://pycrc.org * using the configuration: * - Width = 8 * - Poly = 0x31 * - XorIn = 0x00 * - ReflectIn = True * - XorOut = 0x00 * - ReflectOut = True * - Algorithm = table-driven */ #include "crc8_1wire.h" /** * Static table used for the table_driven implementation. */ static const crc8_t crc8_table[256] = { 0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35 }; crc8_t crc8_1wire_update(crc8_t crc, const void *data, size_t data_len) { const unsigned char *d = (const unsigned char *)data; unsigned int tbl_idx; while (data_len--) { tbl_idx = crc ^ *d; crc = (crc8_table[tbl_idx] ^ (crc >> 8)) & 0xff; d++; } return crc & 0xff; } postmodern-digest-crc-4adf113/ext/digest/crc8_1wire/crc8_1wire.h000066400000000000000000000002331474611004500244770ustar00rootroot00000000000000#ifndef _CRC8_1WIRE_H_ #define _CRC8_1WIRE_H_ #include "../crc8/crc8.h" crc8_t crc8_1wire_update(crc8_t crc, const void *data, size_t data_len); #endif postmodern-digest-crc-4adf113/ext/digest/crc8_1wire/crc8_1wire_ext.c000066400000000000000000000013551474611004500253600ustar00rootroot00000000000000#include "ruby.h" #include "extconf.h" #include "crc8_1wire.h" VALUE Digest_CRC81Wire_update(VALUE self, VALUE data) { VALUE crc_ivar_name = rb_intern("@crc"); VALUE crc_ivar = rb_ivar_get(self, crc_ivar_name); crc8_t crc = NUM2CHR(crc_ivar); const char *data_ptr = StringValuePtr(data); size_t length = RSTRING_LEN(data); crc = crc8_1wire_update(crc,data_ptr,length); rb_ivar_set(self, crc_ivar_name, UINT2NUM(crc)); return self; } void Init_crc8_1wire_ext() { VALUE mDigest = rb_const_get(rb_cObject, rb_intern("Digest")); VALUE cCRC81Wire = rb_const_get(mDigest, rb_intern("CRC8_1Wire")); #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); #endif rb_define_method(cCRC81Wire, "update", Digest_CRC81Wire_update, 1); } postmodern-digest-crc-4adf113/ext/digest/crc8_1wire/extconf.rb000066400000000000000000000001601474611004500243520ustar00rootroot00000000000000require 'mkmf' have_header("stdint.h") have_header('stddef.h') create_header create_makefile "crc8_1wire_ext" postmodern-digest-crc-4adf113/gemspec.yml000066400000000000000000000013471474611004500205100ustar00rootroot00000000000000name: digest-crc version: 0.7.0 summary: A Cyclic Redundancy Check (CRC) library for Ruby. description: Adds support for calculating Cyclic Redundancy Check (CRC) to the Digest module. license: MIT authors: Postmodern email: postmodern.mod3@gmail.com homepage: https://github.com/postmodern/digest-crc#readme metadata: documentation_uri: https://rubydoc.info/gems/digest-crc source_code_uri: https://github.com/postmodern/digest-crc bug_tracker_uri: https://github.com/postmodern/digest-crc/issues changelog_uri: https://github.com/postmodern/digest-crc/blob/master/ChangeLog.md extensions: - ext/digest/Rakefile has_yard: true dependencies: rake: ">= 12.0.0, < 14.0.0" development_dependencies: bundler: ~> 2.0 postmodern-digest-crc-4adf113/lib/000077500000000000000000000000001474611004500171035ustar00rootroot00000000000000postmodern-digest-crc-4adf113/lib/digest/000077500000000000000000000000001474611004500203625ustar00rootroot00000000000000postmodern-digest-crc-4adf113/lib/digest/crc.rb000066400000000000000000000106061474611004500214610ustar00rootroot00000000000000require 'digest' module Digest # # Base class for all CRC algorithms. # class CRC < Digest::Class include Digest::Instance # The initial value of the CRC checksum INIT_CRC = 0x00 # The XOR mask to apply to the resulting CRC checksum XOR_MASK = 0x00 # The bit width of the CRC checksum WIDTH = 0 # Define true or false whether the input direction is bit reversed or not of the CRC checksum REFLECT_INPUT = nil # Default place holder CRC table TABLE = [].freeze # # Calculates the CRC checksum. # # @param [String] data # The given data. # # @return [Integer] # The CRC checksum. # def self.checksum(data) crc = self.new crc << data return crc.checksum end # # Packs the given CRC checksum. # # @param [Integer] crc # The raw CRC checksum. # # @return [String] # The packed CRC checksum. # def self.pack(crc) unless (width = self::WIDTH) > 0 raise(NotImplementedError, "#{self} is incompleted as CRC") end bitclass = width + (-width & 0x07) byte_count = bitclass / 8 crc &= ~(-1 << width) result = [crc].pack("Q>") result[0, result.bytesize - byte_count] = "" result end # # Determines whether the library is using the optimized C extensions # implementation, or the pure-Ruby implementation. # # @return [:c_ext, :pure] # # @since 0.7.0 # def self.implementation if instance_method(:update).source_location.nil? :c_ext else :pure end end # # Initializes the CRC checksum. # def initialize @init_crc = self.class.const_get(:INIT_CRC) @xor_mask = self.class.const_get(:XOR_MASK) @width = self.class.const_get(:WIDTH) @reflect_input = self.class.const_get(:REFLECT_INPUT) @table = self.class.const_get(:TABLE) reset end # # The input block length. # # @return [1] # def block_length 1 end # # The length of the digest. # # @return [Integer] # The length in bytes. # def digest_length (@width / 8.0).ceil end # # Updates the CRC checksum with the given data. # # @param [String] data # The data to update the CRC checksum with. # # @raise [NotImplementedError] # If WIDTH, TABLE, or REFLECT_INPUT constants are not set properly. # def update(data) unless @width >= 1 raise(NotImplementedError, "incompleted #{self.class} as CRC (expected WIDTH to be 1 or more)") end if @table.empty? raise(NotImplementedError, "incompleted #{self.class} as CRC (expected TABLE to be not empty)") end if @reflect_input.nil? raise(NotImplementedError, "incompleted #{self.class} as CRC (expected REFLECT_INPUT to be not nil)") end table = @table crc = @crc if @reflect_input if @width > 8 data.each_byte do |b| crc = table[b ^ (0xff & crc)] ^ (crc >> 8) end else data.each_byte do |b| # Omit (crc >> 8) since bits upper than the lower 8 bits are always 0 crc = table[b ^ (0xff & crc)] end end else if @width > 8 higher_bit_off = @width - 8 remain_mask = ~(-1 << higher_bit_off) data.each_byte do |b| crc = table[b ^ (0xff & (crc >> higher_bit_off))] ^ ((remain_mask & crc) << 8) end else padding = 8 - @width data.each_byte do |b| # Omit (crc << 8) since bits lower than the upper 8 bits are always 0 crc = table[b ^ (0xff & (crc << padding))] end end end @crc = crc self end # # @see #update # def <<(data) update(data) return self end # # Resets the CRC checksum. # # @return [Integer] # The default value of the CRC checksum. # def reset @crc = @init_crc end # # The resulting CRC checksum. # # @return [Integer] # The resulting CRC checksum. # def checksum @crc ^ @xor_mask end # # Finishes the CRC checksum calculation. # # @see pack # def finish self.class.pack(checksum) end end end postmodern-digest-crc-4adf113/lib/digest/crc1.rb000066400000000000000000000010301474611004500215310ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC1 algorithm. # class CRC1 < CRC WIDTH = 1 # # Packs the CRC1 checksum. # # @return [String] # The CRC1 checksum. # def self.pack(crc) [crc].pack('c*') end # # Updates the CRC1 checksum. # # @param [String] data # The data to update the checksum with. # def update(data) accum = 0 data.each_byte { |b| accum += b } @crc += (accum % 256) return self end end end postmodern-digest-crc-4adf113/lib/digest/crc15.rb000066400000000000000000000047361474611004500216360ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC15 algorithm. # # @since 0.5.0 # class CRC15 < CRC WIDTH = 15 REFLECT_INPUT = false # Generated by `./pycrc.py --algorithm=table-driven --model=crc-16 --generate=c` TABLE = [ 0x0000, 0x4599, 0x4eab, 0x0b32, 0x58cf, 0x1d56, 0x1664, 0x53fd, 0x7407, 0x319e, 0x3aac, 0x7f35, 0x2cc8, 0x6951, 0x6263, 0x27fa, 0x2d97, 0x680e, 0x633c, 0x26a5, 0x7558, 0x30c1, 0x3bf3, 0x7e6a, 0x5990, 0x1c09, 0x173b, 0x52a2, 0x015f, 0x44c6, 0x4ff4, 0x0a6d, 0x5b2e, 0x1eb7, 0x1585, 0x501c, 0x03e1, 0x4678, 0x4d4a, 0x08d3, 0x2f29, 0x6ab0, 0x6182, 0x241b, 0x77e6, 0x327f, 0x394d, 0x7cd4, 0x76b9, 0x3320, 0x3812, 0x7d8b, 0x2e76, 0x6bef, 0x60dd, 0x2544, 0x02be, 0x4727, 0x4c15, 0x098c, 0x5a71, 0x1fe8, 0x14da, 0x5143, 0x73c5, 0x365c, 0x3d6e, 0x78f7, 0x2b0a, 0x6e93, 0x65a1, 0x2038, 0x07c2, 0x425b, 0x4969, 0x0cf0, 0x5f0d, 0x1a94, 0x11a6, 0x543f, 0x5e52, 0x1bcb, 0x10f9, 0x5560, 0x069d, 0x4304, 0x4836, 0x0daf, 0x2a55, 0x6fcc, 0x64fe, 0x2167, 0x729a, 0x3703, 0x3c31, 0x79a8, 0x28eb, 0x6d72, 0x6640, 0x23d9, 0x7024, 0x35bd, 0x3e8f, 0x7b16, 0x5cec, 0x1975, 0x1247, 0x57de, 0x0423, 0x41ba, 0x4a88, 0x0f11, 0x057c, 0x40e5, 0x4bd7, 0x0e4e, 0x5db3, 0x182a, 0x1318, 0x5681, 0x717b, 0x34e2, 0x3fd0, 0x7a49, 0x29b4, 0x6c2d, 0x671f, 0x2286, 0x2213, 0x678a, 0x6cb8, 0x2921, 0x7adc, 0x3f45, 0x3477, 0x71ee, 0x5614, 0x138d, 0x18bf, 0x5d26, 0x0edb, 0x4b42, 0x4070, 0x05e9, 0x0f84, 0x4a1d, 0x412f, 0x04b6, 0x574b, 0x12d2, 0x19e0, 0x5c79, 0x7b83, 0x3e1a, 0x3528, 0x70b1, 0x234c, 0x66d5, 0x6de7, 0x287e, 0x793d, 0x3ca4, 0x3796, 0x720f, 0x21f2, 0x646b, 0x6f59, 0x2ac0, 0x0d3a, 0x48a3, 0x4391, 0x0608, 0x55f5, 0x106c, 0x1b5e, 0x5ec7, 0x54aa, 0x1133, 0x1a01, 0x5f98, 0x0c65, 0x49fc, 0x42ce, 0x0757, 0x20ad, 0x6534, 0x6e06, 0x2b9f, 0x7862, 0x3dfb, 0x36c9, 0x7350, 0x51d6, 0x144f, 0x1f7d, 0x5ae4, 0x0919, 0x4c80, 0x47b2, 0x022b, 0x25d1, 0x6048, 0x6b7a, 0x2ee3, 0x7d1e, 0x3887, 0x33b5, 0x762c, 0x7c41, 0x39d8, 0x32ea, 0x7773, 0x248e, 0x6117, 0x6a25, 0x2fbc, 0x0846, 0x4ddf, 0x46ed, 0x0374, 0x5089, 0x1510, 0x1e22, 0x5bbb, 0x0af8, 0x4f61, 0x4453, 0x01ca, 0x5237, 0x17ae, 0x1c9c, 0x5905, 0x7eff, 0x3b66, 0x3054, 0x75cd, 0x2630, 0x63a9, 0x689b, 0x2d02, 0x276f, 0x62f6, 0x69c4, 0x2c5d, 0x7fa0, 0x3a39, 0x310b, 0x7492, 0x5368, 0x16f1, 0x1dc3, 0x585a, 0x0ba7, 0x4e3e, 0x450c, 0x0095 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc15/crc15_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16.rb000066400000000000000000000050621474611004500216300ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC16 algorithm. # class CRC16 < CRC WIDTH = 16 REFLECT_INPUT = true INIT_CRC = 0x0000 # Generated by `./pycrc.py --algorithm=table-driven --model=crc-16` TABLE = [ 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16/crc16_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_ccitt.rb000066400000000000000000000051211474611004500230120ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 CCITT algorithm. # class CRC16CCITT < CRC16 REFLECT_INPUT = false INIT_CRC = 0xffff # Generated by `./pycrc.py --algorithm=table-driven --model=crc-16-ccitt --generate=c` TABLE = [ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_ccitt/crc16_ccitt_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_dnp.rb000066400000000000000000000053751474611004500225000ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 DNP algorithm. # class CRC16DNP < CRC16 REFLECT_INPUT = true INIT_CRC = 0 TABLE = [ 0x0000, 0x365e, 0x6cbc, 0x5ae2, 0xd978, 0xef26, 0xb5c4, 0x839a, 0xff89, 0xc9d7, 0x9335, 0xa56b, 0x26f1, 0x10af, 0x4a4d, 0x7c13, 0xb26b, 0x8435, 0xded7, 0xe889, 0x6b13, 0x5d4d, 0x07af, 0x31f1, 0x4de2, 0x7bbc, 0x215e, 0x1700, 0x949a, 0xa2c4, 0xf826, 0xce78, 0x29af, 0x1ff1, 0x4513, 0x734d, 0xf0d7, 0xc689, 0x9c6b, 0xaa35, 0xd626, 0xe078, 0xba9a, 0x8cc4, 0x0f5e, 0x3900, 0x63e2, 0x55bc, 0x9bc4, 0xad9a, 0xf778, 0xc126, 0x42bc, 0x74e2, 0x2e00, 0x185e, 0x644d, 0x5213, 0x08f1, 0x3eaf, 0xbd35, 0x8b6b, 0xd189, 0xe7d7, 0x535e, 0x6500, 0x3fe2, 0x09bc, 0x8a26, 0xbc78, 0xe69a, 0xd0c4, 0xacd7, 0x9a89, 0xc06b, 0xf635, 0x75af, 0x43f1, 0x1913, 0x2f4d, 0xe135, 0xd76b, 0x8d89, 0xbbd7, 0x384d, 0x0e13, 0x54f1, 0x62af, 0x1ebc, 0x28e2, 0x7200, 0x445e, 0xc7c4, 0xf19a, 0xab78, 0x9d26, 0x7af1, 0x4caf, 0x164d, 0x2013, 0xa389, 0x95d7, 0xcf35, 0xf96b, 0x8578, 0xb326, 0xe9c4, 0xdf9a, 0x5c00, 0x6a5e, 0x30bc, 0x06e2, 0xc89a, 0xfec4, 0xa426, 0x9278, 0x11e2, 0x27bc, 0x7d5e, 0x4b00, 0x3713, 0x014d, 0x5baf, 0x6df1, 0xee6b, 0xd835, 0x82d7, 0xb489, 0xa6bc, 0x90e2, 0xca00, 0xfc5e, 0x7fc4, 0x499a, 0x1378, 0x2526, 0x5935, 0x6f6b, 0x3589, 0x03d7, 0x804d, 0xb613, 0xecf1, 0xdaaf, 0x14d7, 0x2289, 0x786b, 0x4e35, 0xcdaf, 0xfbf1, 0xa113, 0x974d, 0xeb5e, 0xdd00, 0x87e2, 0xb1bc, 0x3226, 0x0478, 0x5e9a, 0x68c4, 0x8f13, 0xb94d, 0xe3af, 0xd5f1, 0x566b, 0x6035, 0x3ad7, 0x0c89, 0x709a, 0x46c4, 0x1c26, 0x2a78, 0xa9e2, 0x9fbc, 0xc55e, 0xf300, 0x3d78, 0x0b26, 0x51c4, 0x679a, 0xe400, 0xd25e, 0x88bc, 0xbee2, 0xc2f1, 0xf4af, 0xae4d, 0x9813, 0x1b89, 0x2dd7, 0x7735, 0x416b, 0xf5e2, 0xc3bc, 0x995e, 0xaf00, 0x2c9a, 0x1ac4, 0x4026, 0x7678, 0x0a6b, 0x3c35, 0x66d7, 0x5089, 0xd313, 0xe54d, 0xbfaf, 0x89f1, 0x4789, 0x71d7, 0x2b35, 0x1d6b, 0x9ef1, 0xa8af, 0xf24d, 0xc413, 0xb800, 0x8e5e, 0xd4bc, 0xe2e2, 0x6178, 0x5726, 0x0dc4, 0x3b9a, 0xdc4d, 0xea13, 0xb0f1, 0x86af, 0x0535, 0x336b, 0x6989, 0x5fd7, 0x23c4, 0x159a, 0x4f78, 0x7926, 0xfabc, 0xcce2, 0x9600, 0xa05e, 0x6e26, 0x5878, 0x029a, 0x34c4, 0xb75e, 0x8100, 0xdbe2, 0xedbc, 0x91af, 0xa7f1, 0xfd13, 0xcb4d, 0x48d7, 0x7e89, 0x246b, 0x1235 ].freeze def finish self.class.pack(~@crc) end end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_dnp/crc16_dnp_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_genibus.rb000066400000000000000000000052411474611004500233430ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 Genibus algorithm. # # @since 0.5.0 # class CRC16Genibus < CRC16 REFLECT_INPUT = false INIT_XOR = 0xffff INIT_CRC = 0x0000 ^ INIT_XOR XOR_MASK = 0xffff # Generated by `./pycrc.py --algorithm=table-driven --model=crc-16 --generate=c` TABLE = [ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_genibus/crc16_genibus_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_kermit.rb000066400000000000000000000051111474611004500231760ustar00rootroot00000000000000require "digest/crc16" module Digest # # Implements Kermit's CRC16 function. # # @since 0.5.0 # class CRC16Kermit < CRC16 REFLECT_INPUT = true # Generated by `./pycrc.py --algorithm=table-driven --model=kermit --generate=c` TABLE = [ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_kermit/crc16_kermit_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_modbus.rb000066400000000000000000000050731474611004500232030ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 Modbus algorithm. # class CRC16Modbus < CRC16 INIT_CRC = 0xffff # Generated by `./pycrc.py --algorithm=table-driven --model=crc-16-modbus --generate=c` TABLE = [ 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_modbus/crc16_modbus_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_qt.rb000066400000000000000000000003271474611004500223330ustar00rootroot00000000000000require 'digest/crc16_x_25' module Digest # # Implements the CRC16_CCITT algorithm used in QT algorithms. # # @note Is exactly the same as the CRC16 X-25 algorithm. # class CRC16QT < CRC16X25 end end postmodern-digest-crc-4adf113/lib/digest/crc16_usb.rb000066400000000000000000000004171474611004500225000ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 USB algorithm. # class CRC16USB < CRC16 INIT_CRC = 0xffff XOR_MASK = 0xffff end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_usb/crc16_usb_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_x_25.rb000066400000000000000000000051701474611004500224650ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 X25 algorithm. # class CRC16X25 < CRC16 REFLECT_INPUT = true INIT_XOR = 0xffff INIT_CRC = 0x0 ^ INIT_XOR XOR_MASK = 0xffff # Generated by `./pycrc.py --algorithm=table-driven --model=x-25 --generate=c` TABLE = [ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_x_25/crc16_x_25_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_xmodem.rb000066400000000000000000000050711474611004500232010ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 XMmodem algorithm. # class CRC16XModem < CRC16 REFLECT_INPUT = false # Generated by `./pycrc.py --algorithm=table-driven --model=xmodem --generate=c` TABLE = [ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_xmodem/crc16_xmodem_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc16_zmodem.rb000066400000000000000000000050701474611004500232020ustar00rootroot00000000000000require 'digest/crc16' module Digest # # Implements the CRC16 ZModem algorithm. # class CRC16ZModem < CRC16 REFLECT_INPUT = false # Generated by `./pycrc.py --algorithm=table-driven --model=zmodem --generate=c` TABLE = [ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc16_zmodem/crc16_zmodem_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc24.rb000066400000000000000000000061001474611004500216210ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC24 algorithm. # class CRC24 < CRC WIDTH = 24 REFLECT_INPUT = false INIT_CRC = 0xb704ce # Generated by `./pycrc.py --algorithm=table-drive --model=crc24 --generate=c` TABLE = [ 0x000000, 0x864cfb, 0x8ad50d, 0x0c99f6, 0x93e6e1, 0x15aa1a, 0x1933ec, 0x9f7f17, 0xa18139, 0x27cdc2, 0x2b5434, 0xad18cf, 0x3267d8, 0xb42b23, 0xb8b2d5, 0x3efe2e, 0xc54e89, 0x430272, 0x4f9b84, 0xc9d77f, 0x56a868, 0xd0e493, 0xdc7d65, 0x5a319e, 0x64cfb0, 0xe2834b, 0xee1abd, 0x685646, 0xf72951, 0x7165aa, 0x7dfc5c, 0xfbb0a7, 0x0cd1e9, 0x8a9d12, 0x8604e4, 0x00481f, 0x9f3708, 0x197bf3, 0x15e205, 0x93aefe, 0xad50d0, 0x2b1c2b, 0x2785dd, 0xa1c926, 0x3eb631, 0xb8faca, 0xb4633c, 0x322fc7, 0xc99f60, 0x4fd39b, 0x434a6d, 0xc50696, 0x5a7981, 0xdc357a, 0xd0ac8c, 0x56e077, 0x681e59, 0xee52a2, 0xe2cb54, 0x6487af, 0xfbf8b8, 0x7db443, 0x712db5, 0xf7614e, 0x19a3d2, 0x9fef29, 0x9376df, 0x153a24, 0x8a4533, 0x0c09c8, 0x00903e, 0x86dcc5, 0xb822eb, 0x3e6e10, 0x32f7e6, 0xb4bb1d, 0x2bc40a, 0xad88f1, 0xa11107, 0x275dfc, 0xdced5b, 0x5aa1a0, 0x563856, 0xd074ad, 0x4f0bba, 0xc94741, 0xc5deb7, 0x43924c, 0x7d6c62, 0xfb2099, 0xf7b96f, 0x71f594, 0xee8a83, 0x68c678, 0x645f8e, 0xe21375, 0x15723b, 0x933ec0, 0x9fa736, 0x19ebcd, 0x8694da, 0x00d821, 0x0c41d7, 0x8a0d2c, 0xb4f302, 0x32bff9, 0x3e260f, 0xb86af4, 0x2715e3, 0xa15918, 0xadc0ee, 0x2b8c15, 0xd03cb2, 0x567049, 0x5ae9bf, 0xdca544, 0x43da53, 0xc596a8, 0xc90f5e, 0x4f43a5, 0x71bd8b, 0xf7f170, 0xfb6886, 0x7d247d, 0xe25b6a, 0x641791, 0x688e67, 0xeec29c, 0x3347a4, 0xb50b5f, 0xb992a9, 0x3fde52, 0xa0a145, 0x26edbe, 0x2a7448, 0xac38b3, 0x92c69d, 0x148a66, 0x181390, 0x9e5f6b, 0x01207c, 0x876c87, 0x8bf571, 0x0db98a, 0xf6092d, 0x7045d6, 0x7cdc20, 0xfa90db, 0x65efcc, 0xe3a337, 0xef3ac1, 0x69763a, 0x578814, 0xd1c4ef, 0xdd5d19, 0x5b11e2, 0xc46ef5, 0x42220e, 0x4ebbf8, 0xc8f703, 0x3f964d, 0xb9dab6, 0xb54340, 0x330fbb, 0xac70ac, 0x2a3c57, 0x26a5a1, 0xa0e95a, 0x9e1774, 0x185b8f, 0x14c279, 0x928e82, 0x0df195, 0x8bbd6e, 0x872498, 0x016863, 0xfad8c4, 0x7c943f, 0x700dc9, 0xf64132, 0x693e25, 0xef72de, 0xe3eb28, 0x65a7d3, 0x5b59fd, 0xdd1506, 0xd18cf0, 0x57c00b, 0xc8bf1c, 0x4ef3e7, 0x426a11, 0xc426ea, 0x2ae476, 0xaca88d, 0xa0317b, 0x267d80, 0xb90297, 0x3f4e6c, 0x33d79a, 0xb59b61, 0x8b654f, 0x0d29b4, 0x01b042, 0x87fcb9, 0x1883ae, 0x9ecf55, 0x9256a3, 0x141a58, 0xefaaff, 0x69e604, 0x657ff2, 0xe33309, 0x7c4c1e, 0xfa00e5, 0xf69913, 0x70d5e8, 0x4e2bc6, 0xc8673d, 0xc4fecb, 0x42b230, 0xddcd27, 0x5b81dc, 0x57182a, 0xd154d1, 0x26359f, 0xa07964, 0xace092, 0x2aac69, 0xb5d37e, 0x339f85, 0x3f0673, 0xb94a88, 0x87b4a6, 0x01f85d, 0x0d61ab, 0x8b2d50, 0x145247, 0x921ebc, 0x9e874a, 0x18cbb1, 0xe37b16, 0x6537ed, 0x69ae1b, 0xefe2e0, 0x709df7, 0xf6d10c, 0xfa48fa, 0x7c0401, 0x42fa2f, 0xc4b6d4, 0xc82f22, 0x4e63d9, 0xd11cce, 0x575035, 0x5bc9c3, 0xdd8538 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc24/crc24_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc32.rb000066400000000000000000000074361474611004500216350ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC32 algorithm. # class CRC32 < CRC WIDTH = 32 REFLECT_INPUT = true INIT_CRC = 0xffffffff XOR_MASK = 0xffffffff # Generated by `./pycrc.py --algorithm=table-driven --model=crc-32 --generate=c` TABLE = [ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc32/crc32_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc32_bzip2.rb000066400000000000000000000070711474611004500227360ustar00rootroot00000000000000require 'digest/crc32' module Digest # # Implements the CRC32 BZip2 algorithm # class CRC32BZip2 < CRC32 REFLECT_INPUT = false # Generated by `./pycrc.py --algorithm=table-driven --model=crc-32-bzip2 --generate=c` TABLE = [ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc32_bzip2/crc32_bzip2_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc32_jam.rb000066400000000000000000000003171474611004500224530ustar00rootroot00000000000000require 'digest/crc32' module Digest # # Implements the CRC32 Jam algorithm. # class CRC32Jam < CRC32 INIT_XOR = 0xffffffff INIT_CRC = 0x0 ^ INIT_XOR XOR_MASK = 0x00000000 end end postmodern-digest-crc-4adf113/lib/digest/crc32_mpeg.rb000066400000000000000000000075211474611004500226400ustar00rootroot00000000000000require 'digest/crc32' module Digest # # Implements the CRC32 Mpeg algorithm. # class CRC32MPEG < CRC32 REFLECT_INPUT = false XOR_MASK = 0x00000000 # Generated by `./pycrc.py --algorithm=table-driven --model=crc-32-mpeg --generate=c` TABLE = [ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 ].freeze end # @deprecated Please use {CRC32MPEG}. CRC32Mpeg = CRC32MPEG end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc32_mpeg/crc32_mpeg_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc32_posix.rb000066400000000000000000000066721474611004500230600ustar00rootroot00000000000000require 'digest/crc32' module Digest # # Implements the CRC32 POSIX algorithm. # class CRC32POSIX < CRC32 REFLECT_INPUT = false INIT_CRC = 0x00000000 TABLE = [ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc32_posix/crc32_posix_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc32_xfer.rb000066400000000000000000000071441474611004500226550ustar00rootroot00000000000000require 'digest/crc32' module Digest # # Implements the CRC32 XFER algorithm. # class CRC32XFER < CRC32 REFLECT_INPUT = false INIT_CRC = 0x00000000 XOR_MASK = 0x00000000 # Generated by `./pycrc.py --algorithm=table-driven --model=xfer --generate=c` TABLE = [ 0x00000000, 0x000000af, 0x0000015e, 0x000001f1, 0x000002bc, 0x00000213, 0x000003e2, 0x0000034d, 0x00000578, 0x000005d7, 0x00000426, 0x00000489, 0x000007c4, 0x0000076b, 0x0000069a, 0x00000635, 0x00000af0, 0x00000a5f, 0x00000bae, 0x00000b01, 0x0000084c, 0x000008e3, 0x00000912, 0x000009bd, 0x00000f88, 0x00000f27, 0x00000ed6, 0x00000e79, 0x00000d34, 0x00000d9b, 0x00000c6a, 0x00000cc5, 0x000015e0, 0x0000154f, 0x000014be, 0x00001411, 0x0000175c, 0x000017f3, 0x00001602, 0x000016ad, 0x00001098, 0x00001037, 0x000011c6, 0x00001169, 0x00001224, 0x0000128b, 0x0000137a, 0x000013d5, 0x00001f10, 0x00001fbf, 0x00001e4e, 0x00001ee1, 0x00001dac, 0x00001d03, 0x00001cf2, 0x00001c5d, 0x00001a68, 0x00001ac7, 0x00001b36, 0x00001b99, 0x000018d4, 0x0000187b, 0x0000198a, 0x00001925, 0x00002bc0, 0x00002b6f, 0x00002a9e, 0x00002a31, 0x0000297c, 0x000029d3, 0x00002822, 0x0000288d, 0x00002eb8, 0x00002e17, 0x00002fe6, 0x00002f49, 0x00002c04, 0x00002cab, 0x00002d5a, 0x00002df5, 0x00002130, 0x0000219f, 0x0000206e, 0x000020c1, 0x0000238c, 0x00002323, 0x000022d2, 0x0000227d, 0x00002448, 0x000024e7, 0x00002516, 0x000025b9, 0x000026f4, 0x0000265b, 0x000027aa, 0x00002705, 0x00003e20, 0x00003e8f, 0x00003f7e, 0x00003fd1, 0x00003c9c, 0x00003c33, 0x00003dc2, 0x00003d6d, 0x00003b58, 0x00003bf7, 0x00003a06, 0x00003aa9, 0x000039e4, 0x0000394b, 0x000038ba, 0x00003815, 0x000034d0, 0x0000347f, 0x0000358e, 0x00003521, 0x0000366c, 0x000036c3, 0x00003732, 0x0000379d, 0x000031a8, 0x00003107, 0x000030f6, 0x00003059, 0x00003314, 0x000033bb, 0x0000324a, 0x000032e5, 0x00005780, 0x0000572f, 0x000056de, 0x00005671, 0x0000553c, 0x00005593, 0x00005462, 0x000054cd, 0x000052f8, 0x00005257, 0x000053a6, 0x00005309, 0x00005044, 0x000050eb, 0x0000511a, 0x000051b5, 0x00005d70, 0x00005ddf, 0x00005c2e, 0x00005c81, 0x00005fcc, 0x00005f63, 0x00005e92, 0x00005e3d, 0x00005808, 0x000058a7, 0x00005956, 0x000059f9, 0x00005ab4, 0x00005a1b, 0x00005bea, 0x00005b45, 0x00004260, 0x000042cf, 0x0000433e, 0x00004391, 0x000040dc, 0x00004073, 0x00004182, 0x0000412d, 0x00004718, 0x000047b7, 0x00004646, 0x000046e9, 0x000045a4, 0x0000450b, 0x000044fa, 0x00004455, 0x00004890, 0x0000483f, 0x000049ce, 0x00004961, 0x00004a2c, 0x00004a83, 0x00004b72, 0x00004bdd, 0x00004de8, 0x00004d47, 0x00004cb6, 0x00004c19, 0x00004f54, 0x00004ffb, 0x00004e0a, 0x00004ea5, 0x00007c40, 0x00007cef, 0x00007d1e, 0x00007db1, 0x00007efc, 0x00007e53, 0x00007fa2, 0x00007f0d, 0x00007938, 0x00007997, 0x00007866, 0x000078c9, 0x00007b84, 0x00007b2b, 0x00007ada, 0x00007a75, 0x000076b0, 0x0000761f, 0x000077ee, 0x00007741, 0x0000740c, 0x000074a3, 0x00007552, 0x000075fd, 0x000073c8, 0x00007367, 0x00007296, 0x00007239, 0x00007174, 0x000071db, 0x0000702a, 0x00007085, 0x000069a0, 0x0000690f, 0x000068fe, 0x00006851, 0x00006b1c, 0x00006bb3, 0x00006a42, 0x00006aed, 0x00006cd8, 0x00006c77, 0x00006d86, 0x00006d29, 0x00006e64, 0x00006ecb, 0x00006f3a, 0x00006f95, 0x00006350, 0x000063ff, 0x0000620e, 0x000062a1, 0x000061ec, 0x00006143, 0x000060b2, 0x0000601d, 0x00006628, 0x00006687, 0x00006776, 0x000067d9, 0x00006494, 0x0000643b, 0x000065ca, 0x00006565 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc32_xfer/crc32_xfer_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc32c.rb000066400000000000000000000073071474611004500217750ustar00rootroot00000000000000require 'digest/crc32' module Digest # # Implements the CRC32c algorithm. # class CRC32c < CRC32 # Generated by `./pycrc.py --algorithm=table-driven --model=crc-32c --generate=c` TABLE = [ 0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b, 0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b, 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384, 0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b, 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a, 0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5, 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa, 0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a, 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a, 0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48, 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957, 0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198, 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927, 0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8, 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7, 0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789, 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859, 0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9, 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6, 0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829, 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c, 0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043, 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c, 0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc, 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c, 0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652, 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d, 0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982, 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d, 0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2, 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed, 0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f, 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff, 0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f, 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540, 0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f, 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee, 0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321, 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e, 0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e, 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e, 0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc32c/crc32c_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc5.rb000066400000000000000000000042151474611004500215450ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC5 algorithm. # class CRC5 < CRC WIDTH = 5 REFLECT_INPUT = true INIT_CRC = 0x1f XOR_MASK = 0x1f CRC_MASK = 0x1f # Generated by `./pycrc.py --algorithm=table-driven --model=crc-5 --generate=c` TABLE = [ 0x00, 0x0e, 0x1c, 0x12, 0x11, 0x1f, 0x0d, 0x03, 0x0b, 0x05, 0x17, 0x19, 0x1a, 0x14, 0x06, 0x08, 0x16, 0x18, 0x0a, 0x04, 0x07, 0x09, 0x1b, 0x15, 0x1d, 0x13, 0x01, 0x0f, 0x0c, 0x02, 0x10, 0x1e, 0x05, 0x0b, 0x19, 0x17, 0x14, 0x1a, 0x08, 0x06, 0x0e, 0x00, 0x12, 0x1c, 0x1f, 0x11, 0x03, 0x0d, 0x13, 0x1d, 0x0f, 0x01, 0x02, 0x0c, 0x1e, 0x10, 0x18, 0x16, 0x04, 0x0a, 0x09, 0x07, 0x15, 0x1b, 0x0a, 0x04, 0x16, 0x18, 0x1b, 0x15, 0x07, 0x09, 0x01, 0x0f, 0x1d, 0x13, 0x10, 0x1e, 0x0c, 0x02, 0x1c, 0x12, 0x00, 0x0e, 0x0d, 0x03, 0x11, 0x1f, 0x17, 0x19, 0x0b, 0x05, 0x06, 0x08, 0x1a, 0x14, 0x0f, 0x01, 0x13, 0x1d, 0x1e, 0x10, 0x02, 0x0c, 0x04, 0x0a, 0x18, 0x16, 0x15, 0x1b, 0x09, 0x07, 0x19, 0x17, 0x05, 0x0b, 0x08, 0x06, 0x14, 0x1a, 0x12, 0x1c, 0x0e, 0x00, 0x03, 0x0d, 0x1f, 0x11, 0x14, 0x1a, 0x08, 0x06, 0x05, 0x0b, 0x19, 0x17, 0x1f, 0x11, 0x03, 0x0d, 0x0e, 0x00, 0x12, 0x1c, 0x02, 0x0c, 0x1e, 0x10, 0x13, 0x1d, 0x0f, 0x01, 0x09, 0x07, 0x15, 0x1b, 0x18, 0x16, 0x04, 0x0a, 0x11, 0x1f, 0x0d, 0x03, 0x00, 0x0e, 0x1c, 0x12, 0x1a, 0x14, 0x06, 0x08, 0x0b, 0x05, 0x17, 0x19, 0x07, 0x09, 0x1b, 0x15, 0x16, 0x18, 0x0a, 0x04, 0x0c, 0x02, 0x10, 0x1e, 0x1d, 0x13, 0x01, 0x0f, 0x1e, 0x10, 0x02, 0x0c, 0x0f, 0x01, 0x13, 0x1d, 0x15, 0x1b, 0x09, 0x07, 0x04, 0x0a, 0x18, 0x16, 0x08, 0x06, 0x14, 0x1a, 0x19, 0x17, 0x05, 0x0b, 0x03, 0x0d, 0x1f, 0x11, 0x12, 0x1c, 0x0e, 0x00, 0x1b, 0x15, 0x07, 0x09, 0x0a, 0x04, 0x16, 0x18, 0x10, 0x1e, 0x0c, 0x02, 0x01, 0x0f, 0x1d, 0x13, 0x0d, 0x03, 0x11, 0x1f, 0x1c, 0x12, 0x00, 0x0e, 0x06, 0x08, 0x1a, 0x14, 0x17, 0x19, 0x0b, 0x05 ].freeze # # Initializes the CRC5 instance. # def initialize @crc_mask = self.class.const_get(:CRC_MASK) super end end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc5/crc5_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc64.rb000066400000000000000000000134561474611004500216410ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC64 algorithm. # class CRC64 < CRC WIDTH = 64 REFLECT_INPUT = true INIT_CRC = 0x0000000000000000 XOR_MASK = 0x0000000000000000 # Generated by `./pycrc.py --algorithm=table-driven --model=crc-64 --generate=c` TABLE = [ 0x0000000000000000, 0x01b0000000000000, 0x0360000000000000, 0x02d0000000000000, 0x06c0000000000000, 0x0770000000000000, 0x05a0000000000000, 0x0410000000000000, 0x0d80000000000000, 0x0c30000000000000, 0x0ee0000000000000, 0x0f50000000000000, 0x0b40000000000000, 0x0af0000000000000, 0x0820000000000000, 0x0990000000000000, 0x1b00000000000000, 0x1ab0000000000000, 0x1860000000000000, 0x19d0000000000000, 0x1dc0000000000000, 0x1c70000000000000, 0x1ea0000000000000, 0x1f10000000000000, 0x1680000000000000, 0x1730000000000000, 0x15e0000000000000, 0x1450000000000000, 0x1040000000000000, 0x11f0000000000000, 0x1320000000000000, 0x1290000000000000, 0x3600000000000000, 0x37b0000000000000, 0x3560000000000000, 0x34d0000000000000, 0x30c0000000000000, 0x3170000000000000, 0x33a0000000000000, 0x3210000000000000, 0x3b80000000000000, 0x3a30000000000000, 0x38e0000000000000, 0x3950000000000000, 0x3d40000000000000, 0x3cf0000000000000, 0x3e20000000000000, 0x3f90000000000000, 0x2d00000000000000, 0x2cb0000000000000, 0x2e60000000000000, 0x2fd0000000000000, 0x2bc0000000000000, 0x2a70000000000000, 0x28a0000000000000, 0x2910000000000000, 0x2080000000000000, 0x2130000000000000, 0x23e0000000000000, 0x2250000000000000, 0x2640000000000000, 0x27f0000000000000, 0x2520000000000000, 0x2490000000000000, 0x6c00000000000000, 0x6db0000000000000, 0x6f60000000000000, 0x6ed0000000000000, 0x6ac0000000000000, 0x6b70000000000000, 0x69a0000000000000, 0x6810000000000000, 0x6180000000000000, 0x6030000000000000, 0x62e0000000000000, 0x6350000000000000, 0x6740000000000000, 0x66f0000000000000, 0x6420000000000000, 0x6590000000000000, 0x7700000000000000, 0x76b0000000000000, 0x7460000000000000, 0x75d0000000000000, 0x71c0000000000000, 0x7070000000000000, 0x72a0000000000000, 0x7310000000000000, 0x7a80000000000000, 0x7b30000000000000, 0x79e0000000000000, 0x7850000000000000, 0x7c40000000000000, 0x7df0000000000000, 0x7f20000000000000, 0x7e90000000000000, 0x5a00000000000000, 0x5bb0000000000000, 0x5960000000000000, 0x58d0000000000000, 0x5cc0000000000000, 0x5d70000000000000, 0x5fa0000000000000, 0x5e10000000000000, 0x5780000000000000, 0x5630000000000000, 0x54e0000000000000, 0x5550000000000000, 0x5140000000000000, 0x50f0000000000000, 0x5220000000000000, 0x5390000000000000, 0x4100000000000000, 0x40b0000000000000, 0x4260000000000000, 0x43d0000000000000, 0x47c0000000000000, 0x4670000000000000, 0x44a0000000000000, 0x4510000000000000, 0x4c80000000000000, 0x4d30000000000000, 0x4fe0000000000000, 0x4e50000000000000, 0x4a40000000000000, 0x4bf0000000000000, 0x4920000000000000, 0x4890000000000000, 0xd800000000000000, 0xd9b0000000000000, 0xdb60000000000000, 0xdad0000000000000, 0xdec0000000000000, 0xdf70000000000000, 0xdda0000000000000, 0xdc10000000000000, 0xd580000000000000, 0xd430000000000000, 0xd6e0000000000000, 0xd750000000000000, 0xd340000000000000, 0xd2f0000000000000, 0xd020000000000000, 0xd190000000000000, 0xc300000000000000, 0xc2b0000000000000, 0xc060000000000000, 0xc1d0000000000000, 0xc5c0000000000000, 0xc470000000000000, 0xc6a0000000000000, 0xc710000000000000, 0xce80000000000000, 0xcf30000000000000, 0xcde0000000000000, 0xcc50000000000000, 0xc840000000000000, 0xc9f0000000000000, 0xcb20000000000000, 0xca90000000000000, 0xee00000000000000, 0xefb0000000000000, 0xed60000000000000, 0xecd0000000000000, 0xe8c0000000000000, 0xe970000000000000, 0xeba0000000000000, 0xea10000000000000, 0xe380000000000000, 0xe230000000000000, 0xe0e0000000000000, 0xe150000000000000, 0xe540000000000000, 0xe4f0000000000000, 0xe620000000000000, 0xe790000000000000, 0xf500000000000000, 0xf4b0000000000000, 0xf660000000000000, 0xf7d0000000000000, 0xf3c0000000000000, 0xf270000000000000, 0xf0a0000000000000, 0xf110000000000000, 0xf880000000000000, 0xf930000000000000, 0xfbe0000000000000, 0xfa50000000000000, 0xfe40000000000000, 0xfff0000000000000, 0xfd20000000000000, 0xfc90000000000000, 0xb400000000000000, 0xb5b0000000000000, 0xb760000000000000, 0xb6d0000000000000, 0xb2c0000000000000, 0xb370000000000000, 0xb1a0000000000000, 0xb010000000000000, 0xb980000000000000, 0xb830000000000000, 0xbae0000000000000, 0xbb50000000000000, 0xbf40000000000000, 0xbef0000000000000, 0xbc20000000000000, 0xbd90000000000000, 0xaf00000000000000, 0xaeb0000000000000, 0xac60000000000000, 0xadd0000000000000, 0xa9c0000000000000, 0xa870000000000000, 0xaaa0000000000000, 0xab10000000000000, 0xa280000000000000, 0xa330000000000000, 0xa1e0000000000000, 0xa050000000000000, 0xa440000000000000, 0xa5f0000000000000, 0xa720000000000000, 0xa690000000000000, 0x8200000000000000, 0x83b0000000000000, 0x8160000000000000, 0x80d0000000000000, 0x84c0000000000000, 0x8570000000000000, 0x87a0000000000000, 0x8610000000000000, 0x8f80000000000000, 0x8e30000000000000, 0x8ce0000000000000, 0x8d50000000000000, 0x8940000000000000, 0x88f0000000000000, 0x8a20000000000000, 0x8b90000000000000, 0x9900000000000000, 0x98b0000000000000, 0x9a60000000000000, 0x9bd0000000000000, 0x9fc0000000000000, 0x9e70000000000000, 0x9ca0000000000000, 0x9d10000000000000, 0x9480000000000000, 0x9530000000000000, 0x97e0000000000000, 0x9650000000000000, 0x9240000000000000, 0x93f0000000000000, 0x9120000000000000, 0x9090000000000000 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc64/crc64_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc64_jones.rb000066400000000000000000000134661474611004500230400ustar00rootroot00000000000000require 'digest/crc64' module Digest # # Implements the CRC64 Jones algorithm. # # @since 0.5.0 # class CRC64Jones < CRC64 INIT_XOR = 0xffffffffffffffff INIT_CRC = 0x0 ^ INIT_XOR # Generated by `./pycrc.py --algorithm=table-driven --model=crc-64-jones --generate=c` TABLE = [ 0x0000000000000000, 0x7ad870c830358979, 0xf5b0e190606b12f2, 0x8f689158505e9b8b, 0xc038e5739841b68f, 0xbae095bba8743ff6, 0x358804e3f82aa47d, 0x4f50742bc81f2d04, 0xab28ecb46814fe75, 0xd1f09c7c5821770c, 0x5e980d24087fec87, 0x24407dec384a65fe, 0x6b1009c7f05548fa, 0x11c8790fc060c183, 0x9ea0e857903e5a08, 0xe478989fa00bd371, 0x7d08ff3b88be6f81, 0x07d08ff3b88be6f8, 0x88b81eabe8d57d73, 0xf2606e63d8e0f40a, 0xbd301a4810ffd90e, 0xc7e86a8020ca5077, 0x4880fbd87094cbfc, 0x32588b1040a14285, 0xd620138fe0aa91f4, 0xacf86347d09f188d, 0x2390f21f80c18306, 0x594882d7b0f40a7f, 0x1618f6fc78eb277b, 0x6cc0863448deae02, 0xe3a8176c18803589, 0x997067a428b5bcf0, 0xfa11fe77117cdf02, 0x80c98ebf2149567b, 0x0fa11fe77117cdf0, 0x75796f2f41224489, 0x3a291b04893d698d, 0x40f16bccb908e0f4, 0xcf99fa94e9567b7f, 0xb5418a5cd963f206, 0x513912c379682177, 0x2be1620b495da80e, 0xa489f35319033385, 0xde51839b2936bafc, 0x9101f7b0e12997f8, 0xebd98778d11c1e81, 0x64b116208142850a, 0x1e6966e8b1770c73, 0x8719014c99c2b083, 0xfdc17184a9f739fa, 0x72a9e0dcf9a9a271, 0x08719014c99c2b08, 0x4721e43f0183060c, 0x3df994f731b68f75, 0xb29105af61e814fe, 0xc849756751dd9d87, 0x2c31edf8f1d64ef6, 0x56e99d30c1e3c78f, 0xd9810c6891bd5c04, 0xa3597ca0a188d57d, 0xec09088b6997f879, 0x96d1784359a27100, 0x19b9e91b09fcea8b, 0x636199d339c963f2, 0xdf7adabd7a6e2d6f, 0xa5a2aa754a5ba416, 0x2aca3b2d1a053f9d, 0x50124be52a30b6e4, 0x1f423fcee22f9be0, 0x659a4f06d21a1299, 0xeaf2de5e82448912, 0x902aae96b271006b, 0x74523609127ad31a, 0x0e8a46c1224f5a63, 0x81e2d7997211c1e8, 0xfb3aa75142244891, 0xb46ad37a8a3b6595, 0xceb2a3b2ba0eecec, 0x41da32eaea507767, 0x3b024222da65fe1e, 0xa2722586f2d042ee, 0xd8aa554ec2e5cb97, 0x57c2c41692bb501c, 0x2d1ab4dea28ed965, 0x624ac0f56a91f461, 0x1892b03d5aa47d18, 0x97fa21650afae693, 0xed2251ad3acf6fea, 0x095ac9329ac4bc9b, 0x7382b9faaaf135e2, 0xfcea28a2faafae69, 0x8632586aca9a2710, 0xc9622c4102850a14, 0xb3ba5c8932b0836d, 0x3cd2cdd162ee18e6, 0x460abd1952db919f, 0x256b24ca6b12f26d, 0x5fb354025b277b14, 0xd0dbc55a0b79e09f, 0xaa03b5923b4c69e6, 0xe553c1b9f35344e2, 0x9f8bb171c366cd9b, 0x10e3202993385610, 0x6a3b50e1a30ddf69, 0x8e43c87e03060c18, 0xf49bb8b633338561, 0x7bf329ee636d1eea, 0x012b592653589793, 0x4e7b2d0d9b47ba97, 0x34a35dc5ab7233ee, 0xbbcbcc9dfb2ca865, 0xc113bc55cb19211c, 0x5863dbf1e3ac9dec, 0x22bbab39d3991495, 0xadd33a6183c78f1e, 0xd70b4aa9b3f20667, 0x985b3e827bed2b63, 0xe2834e4a4bd8a21a, 0x6debdf121b863991, 0x1733afda2bb3b0e8, 0xf34b37458bb86399, 0x8993478dbb8deae0, 0x06fbd6d5ebd3716b, 0x7c23a61ddbe6f812, 0x3373d23613f9d516, 0x49aba2fe23cc5c6f, 0xc6c333a67392c7e4, 0xbc1b436e43a74e9d, 0x95ac9329ac4bc9b5, 0xef74e3e19c7e40cc, 0x601c72b9cc20db47, 0x1ac40271fc15523e, 0x5594765a340a7f3a, 0x2f4c0692043ff643, 0xa02497ca54616dc8, 0xdafce7026454e4b1, 0x3e847f9dc45f37c0, 0x445c0f55f46abeb9, 0xcb349e0da4342532, 0xb1eceec59401ac4b, 0xfebc9aee5c1e814f, 0x8464ea266c2b0836, 0x0b0c7b7e3c7593bd, 0x71d40bb60c401ac4, 0xe8a46c1224f5a634, 0x927c1cda14c02f4d, 0x1d148d82449eb4c6, 0x67ccfd4a74ab3dbf, 0x289c8961bcb410bb, 0x5244f9a98c8199c2, 0xdd2c68f1dcdf0249, 0xa7f41839ecea8b30, 0x438c80a64ce15841, 0x3954f06e7cd4d138, 0xb63c61362c8a4ab3, 0xcce411fe1cbfc3ca, 0x83b465d5d4a0eece, 0xf96c151de49567b7, 0x76048445b4cbfc3c, 0x0cdcf48d84fe7545, 0x6fbd6d5ebd3716b7, 0x15651d968d029fce, 0x9a0d8ccedd5c0445, 0xe0d5fc06ed698d3c, 0xaf85882d2576a038, 0xd55df8e515432941, 0x5a3569bd451db2ca, 0x20ed197575283bb3, 0xc49581ead523e8c2, 0xbe4df122e51661bb, 0x3125607ab548fa30, 0x4bfd10b2857d7349, 0x04ad64994d625e4d, 0x7e7514517d57d734, 0xf11d85092d094cbf, 0x8bc5f5c11d3cc5c6, 0x12b5926535897936, 0x686de2ad05bcf04f, 0xe70573f555e26bc4, 0x9ddd033d65d7e2bd, 0xd28d7716adc8cfb9, 0xa85507de9dfd46c0, 0x273d9686cda3dd4b, 0x5de5e64efd965432, 0xb99d7ed15d9d8743, 0xc3450e196da80e3a, 0x4c2d9f413df695b1, 0x36f5ef890dc31cc8, 0x79a59ba2c5dc31cc, 0x037deb6af5e9b8b5, 0x8c157a32a5b7233e, 0xf6cd0afa9582aa47, 0x4ad64994d625e4da, 0x300e395ce6106da3, 0xbf66a804b64ef628, 0xc5bed8cc867b7f51, 0x8aeeace74e645255, 0xf036dc2f7e51db2c, 0x7f5e4d772e0f40a7, 0x05863dbf1e3ac9de, 0xe1fea520be311aaf, 0x9b26d5e88e0493d6, 0x144e44b0de5a085d, 0x6e963478ee6f8124, 0x21c640532670ac20, 0x5b1e309b16452559, 0xd476a1c3461bbed2, 0xaeaed10b762e37ab, 0x37deb6af5e9b8b5b, 0x4d06c6676eae0222, 0xc26e573f3ef099a9, 0xb8b627f70ec510d0, 0xf7e653dcc6da3dd4, 0x8d3e2314f6efb4ad, 0x0256b24ca6b12f26, 0x788ec2849684a65f, 0x9cf65a1b368f752e, 0xe62e2ad306bafc57, 0x6946bb8b56e467dc, 0x139ecb4366d1eea5, 0x5ccebf68aecec3a1, 0x2616cfa09efb4ad8, 0xa97e5ef8cea5d153, 0xd3a62e30fe90582a, 0xb0c7b7e3c7593bd8, 0xca1fc72bf76cb2a1, 0x45775673a732292a, 0x3faf26bb9707a053, 0x70ff52905f188d57, 0x0a2722586f2d042e, 0x854fb3003f739fa5, 0xff97c3c80f4616dc, 0x1bef5b57af4dc5ad, 0x61372b9f9f784cd4, 0xee5fbac7cf26d75f, 0x9487ca0fff135e26, 0xdbd7be24370c7322, 0xa10fceec0739fa5b, 0x2e675fb4576761d0, 0x54bf2f7c6752e8a9, 0xcdcf48d84fe75459, 0xb71738107fd2dd20, 0x387fa9482f8c46ab, 0x42a7d9801fb9cfd2, 0x0df7adabd7a6e2d6, 0x772fdd63e7936baf, 0xf8474c3bb7cdf024, 0x829f3cf387f8795d, 0x66e7a46c27f3aa2c, 0x1c3fd4a417c62355, 0x935745fc4798b8de, 0xe98f353477ad31a7, 0xa6df411fbfb21ca3, 0xdc0731d78f8795da, 0x536fa08fdfd90e51, 0x29b7d047efec8728 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc64_jones/crc64_jones_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc64_nvme.rb000066400000000000000000000137041474611004500226620ustar00rootroot00000000000000require 'digest/crc64' module Digest # # Implements the CRC64 NVMe algorithm. # # @since 0.7.0 # class CRC64NVMe < CRC64 INIT_XOR = 0xffffffffffffffff INIT_CRC = 0x0 ^ INIT_XOR XOR_MASK = 0xffffffffffffffff # Generated by `./pycrc.py --algorithm=table-driven --width 64 --poly 0xad93d23594c93659 --reflect-in True --xor-in 0xffffffffffffffff --reflect-out True --xor-out 0xffffffffffffffff --generate=c` TABLE = [ 0x0000000000000000, 0x7f6ef0c830358979, 0xfedde190606b12f2, 0x81b31158505e9b8b, 0xc962e5739841b68f, 0xb60c15bba8743ff6, 0x37bf04e3f82aa47d, 0x48d1f42bc81f2d04, 0xa61cecb46814fe75, 0xd9721c7c5821770c, 0x58c10d24087fec87, 0x27affdec384a65fe, 0x6f7e09c7f05548fa, 0x1010f90fc060c183, 0x91a3e857903e5a08, 0xeecd189fa00bd371, 0x78e0ff3b88be6f81, 0x078e0ff3b88be6f8, 0x863d1eabe8d57d73, 0xf953ee63d8e0f40a, 0xb1821a4810ffd90e, 0xceecea8020ca5077, 0x4f5ffbd87094cbfc, 0x30310b1040a14285, 0xdefc138fe0aa91f4, 0xa192e347d09f188d, 0x2021f21f80c18306, 0x5f4f02d7b0f40a7f, 0x179ef6fc78eb277b, 0x68f0063448deae02, 0xe943176c18803589, 0x962de7a428b5bcf0, 0xf1c1fe77117cdf02, 0x8eaf0ebf2149567b, 0x0f1c1fe77117cdf0, 0x7072ef2f41224489, 0x38a31b04893d698d, 0x47cdebccb908e0f4, 0xc67efa94e9567b7f, 0xb9100a5cd963f206, 0x57dd12c379682177, 0x28b3e20b495da80e, 0xa900f35319033385, 0xd66e039b2936bafc, 0x9ebff7b0e12997f8, 0xe1d10778d11c1e81, 0x606216208142850a, 0x1f0ce6e8b1770c73, 0x8921014c99c2b083, 0xf64ff184a9f739fa, 0x77fce0dcf9a9a271, 0x08921014c99c2b08, 0x4043e43f0183060c, 0x3f2d14f731b68f75, 0xbe9e05af61e814fe, 0xc1f0f56751dd9d87, 0x2f3dedf8f1d64ef6, 0x50531d30c1e3c78f, 0xd1e00c6891bd5c04, 0xae8efca0a188d57d, 0xe65f088b6997f879, 0x9931f84359a27100, 0x1882e91b09fcea8b, 0x67ec19d339c963f2, 0xd75adabd7a6e2d6f, 0xa8342a754a5ba416, 0x29873b2d1a053f9d, 0x56e9cbe52a30b6e4, 0x1e383fcee22f9be0, 0x6156cf06d21a1299, 0xe0e5de5e82448912, 0x9f8b2e96b271006b, 0x71463609127ad31a, 0x0e28c6c1224f5a63, 0x8f9bd7997211c1e8, 0xf0f5275142244891, 0xb824d37a8a3b6595, 0xc74a23b2ba0eecec, 0x46f932eaea507767, 0x3997c222da65fe1e, 0xafba2586f2d042ee, 0xd0d4d54ec2e5cb97, 0x5167c41692bb501c, 0x2e0934dea28ed965, 0x66d8c0f56a91f461, 0x19b6303d5aa47d18, 0x980521650afae693, 0xe76bd1ad3acf6fea, 0x09a6c9329ac4bc9b, 0x76c839faaaf135e2, 0xf77b28a2faafae69, 0x8815d86aca9a2710, 0xc0c42c4102850a14, 0xbfaadc8932b0836d, 0x3e19cdd162ee18e6, 0x41773d1952db919f, 0x269b24ca6b12f26d, 0x59f5d4025b277b14, 0xd846c55a0b79e09f, 0xa72835923b4c69e6, 0xeff9c1b9f35344e2, 0x90973171c366cd9b, 0x1124202993385610, 0x6e4ad0e1a30ddf69, 0x8087c87e03060c18, 0xffe938b633338561, 0x7e5a29ee636d1eea, 0x0134d92653589793, 0x49e52d0d9b47ba97, 0x368bddc5ab7233ee, 0xb738cc9dfb2ca865, 0xc8563c55cb19211c, 0x5e7bdbf1e3ac9dec, 0x21152b39d3991495, 0xa0a63a6183c78f1e, 0xdfc8caa9b3f20667, 0x97193e827bed2b63, 0xe877ce4a4bd8a21a, 0x69c4df121b863991, 0x16aa2fda2bb3b0e8, 0xf86737458bb86399, 0x8709c78dbb8deae0, 0x06bad6d5ebd3716b, 0x79d4261ddbe6f812, 0x3105d23613f9d516, 0x4e6b22fe23cc5c6f, 0xcfd833a67392c7e4, 0xb0b6c36e43a74e9d, 0x9a6c9329ac4bc9b5, 0xe50263e19c7e40cc, 0x64b172b9cc20db47, 0x1bdf8271fc15523e, 0x530e765a340a7f3a, 0x2c608692043ff643, 0xadd397ca54616dc8, 0xd2bd67026454e4b1, 0x3c707f9dc45f37c0, 0x431e8f55f46abeb9, 0xc2ad9e0da4342532, 0xbdc36ec59401ac4b, 0xf5129aee5c1e814f, 0x8a7c6a266c2b0836, 0x0bcf7b7e3c7593bd, 0x74a18bb60c401ac4, 0xe28c6c1224f5a634, 0x9de29cda14c02f4d, 0x1c518d82449eb4c6, 0x633f7d4a74ab3dbf, 0x2bee8961bcb410bb, 0x548079a98c8199c2, 0xd53368f1dcdf0249, 0xaa5d9839ecea8b30, 0x449080a64ce15841, 0x3bfe706e7cd4d138, 0xba4d61362c8a4ab3, 0xc52391fe1cbfc3ca, 0x8df265d5d4a0eece, 0xf29c951de49567b7, 0x732f8445b4cbfc3c, 0x0c41748d84fe7545, 0x6bad6d5ebd3716b7, 0x14c39d968d029fce, 0x95708ccedd5c0445, 0xea1e7c06ed698d3c, 0xa2cf882d2576a038, 0xdda178e515432941, 0x5c1269bd451db2ca, 0x237c997575283bb3, 0xcdb181ead523e8c2, 0xb2df7122e51661bb, 0x336c607ab548fa30, 0x4c0290b2857d7349, 0x04d364994d625e4d, 0x7bbd94517d57d734, 0xfa0e85092d094cbf, 0x856075c11d3cc5c6, 0x134d926535897936, 0x6c2362ad05bcf04f, 0xed9073f555e26bc4, 0x92fe833d65d7e2bd, 0xda2f7716adc8cfb9, 0xa54187de9dfd46c0, 0x24f29686cda3dd4b, 0x5b9c664efd965432, 0xb5517ed15d9d8743, 0xca3f8e196da80e3a, 0x4b8c9f413df695b1, 0x34e26f890dc31cc8, 0x7c339ba2c5dc31cc, 0x035d6b6af5e9b8b5, 0x82ee7a32a5b7233e, 0xfd808afa9582aa47, 0x4d364994d625e4da, 0x3258b95ce6106da3, 0xb3eba804b64ef628, 0xcc8558cc867b7f51, 0x8454ace74e645255, 0xfb3a5c2f7e51db2c, 0x7a894d772e0f40a7, 0x05e7bdbf1e3ac9de, 0xeb2aa520be311aaf, 0x944455e88e0493d6, 0x15f744b0de5a085d, 0x6a99b478ee6f8124, 0x224840532670ac20, 0x5d26b09b16452559, 0xdc95a1c3461bbed2, 0xa3fb510b762e37ab, 0x35d6b6af5e9b8b5b, 0x4ab846676eae0222, 0xcb0b573f3ef099a9, 0xb465a7f70ec510d0, 0xfcb453dcc6da3dd4, 0x83daa314f6efb4ad, 0x0269b24ca6b12f26, 0x7d0742849684a65f, 0x93ca5a1b368f752e, 0xeca4aad306bafc57, 0x6d17bb8b56e467dc, 0x12794b4366d1eea5, 0x5aa8bf68aecec3a1, 0x25c64fa09efb4ad8, 0xa4755ef8cea5d153, 0xdb1bae30fe90582a, 0xbcf7b7e3c7593bd8, 0xc399472bf76cb2a1, 0x422a5673a732292a, 0x3d44a6bb9707a053, 0x759552905f188d57, 0x0afba2586f2d042e, 0x8b48b3003f739fa5, 0xf42643c80f4616dc, 0x1aeb5b57af4dc5ad, 0x6585ab9f9f784cd4, 0xe436bac7cf26d75f, 0x9b584a0fff135e26, 0xd389be24370c7322, 0xace74eec0739fa5b, 0x2d545fb4576761d0, 0x523aaf7c6752e8a9, 0xc41748d84fe75459, 0xbb79b8107fd2dd20, 0x3acaa9482f8c46ab, 0x45a459801fb9cfd2, 0x0d75adabd7a6e2d6, 0x721b5d63e7936baf, 0xf3a84c3bb7cdf024, 0x8cc6bcf387f8795d, 0x620ba46c27f3aa2c, 0x1d6554a417c62355, 0x9cd645fc4798b8de, 0xe3b8b53477ad31a7, 0xab69411fbfb21ca3, 0xd407b1d78f8795da, 0x55b4a08fdfd90e51, 0x2ada5047efec8728 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc64_nvme/crc64_nvme_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc64_xz.rb000066400000000000000000000135121474611004500223530ustar00rootroot00000000000000require 'digest/crc64' module Digest # # Implements the CRC64 XZ algorithm. # # @since 0.5.0 # class CRC64XZ < CRC64 INIT_XOR = 0xffffffffffffffff INIT_CRC = 0x0 ^ INIT_XOR XOR_MASK = 0xffffffffffffffff # Generated by `./pycrc.py --algorithm=table-driven --model=crc-64-xz --generate=c` TABLE = [ 0x0000000000000000, 0xb32e4cbe03a75f6f, 0xf4843657a840a05b, 0x47aa7ae9abe7ff34, 0x7bd0c384ff8f5e33, 0xc8fe8f3afc28015c, 0x8f54f5d357cffe68, 0x3c7ab96d5468a107, 0xf7a18709ff1ebc66, 0x448fcbb7fcb9e309, 0x0325b15e575e1c3d, 0xb00bfde054f94352, 0x8c71448d0091e255, 0x3f5f08330336bd3a, 0x78f572daa8d1420e, 0xcbdb3e64ab761d61, 0x7d9ba13851336649, 0xceb5ed8652943926, 0x891f976ff973c612, 0x3a31dbd1fad4997d, 0x064b62bcaebc387a, 0xb5652e02ad1b6715, 0xf2cf54eb06fc9821, 0x41e11855055bc74e, 0x8a3a2631ae2dda2f, 0x39146a8fad8a8540, 0x7ebe1066066d7a74, 0xcd905cd805ca251b, 0xf1eae5b551a2841c, 0x42c4a90b5205db73, 0x056ed3e2f9e22447, 0xb6409f5cfa457b28, 0xfb374270a266cc92, 0x48190ecea1c193fd, 0x0fb374270a266cc9, 0xbc9d3899098133a6, 0x80e781f45de992a1, 0x33c9cd4a5e4ecdce, 0x7463b7a3f5a932fa, 0xc74dfb1df60e6d95, 0x0c96c5795d7870f4, 0xbfb889c75edf2f9b, 0xf812f32ef538d0af, 0x4b3cbf90f69f8fc0, 0x774606fda2f72ec7, 0xc4684a43a15071a8, 0x83c230aa0ab78e9c, 0x30ec7c140910d1f3, 0x86ace348f355aadb, 0x3582aff6f0f2f5b4, 0x7228d51f5b150a80, 0xc10699a158b255ef, 0xfd7c20cc0cdaf4e8, 0x4e526c720f7dab87, 0x09f8169ba49a54b3, 0xbad65a25a73d0bdc, 0x710d64410c4b16bd, 0xc22328ff0fec49d2, 0x85895216a40bb6e6, 0x36a71ea8a7ace989, 0x0adda7c5f3c4488e, 0xb9f3eb7bf06317e1, 0xfe5991925b84e8d5, 0x4d77dd2c5823b7ba, 0x64b62bcaebc387a1, 0xd7986774e864d8ce, 0x90321d9d438327fa, 0x231c512340247895, 0x1f66e84e144cd992, 0xac48a4f017eb86fd, 0xebe2de19bc0c79c9, 0x58cc92a7bfab26a6, 0x9317acc314dd3bc7, 0x2039e07d177a64a8, 0x67939a94bc9d9b9c, 0xd4bdd62abf3ac4f3, 0xe8c76f47eb5265f4, 0x5be923f9e8f53a9b, 0x1c4359104312c5af, 0xaf6d15ae40b59ac0, 0x192d8af2baf0e1e8, 0xaa03c64cb957be87, 0xeda9bca512b041b3, 0x5e87f01b11171edc, 0x62fd4976457fbfdb, 0xd1d305c846d8e0b4, 0x96797f21ed3f1f80, 0x2557339fee9840ef, 0xee8c0dfb45ee5d8e, 0x5da24145464902e1, 0x1a083bacedaefdd5, 0xa9267712ee09a2ba, 0x955cce7fba6103bd, 0x267282c1b9c65cd2, 0x61d8f8281221a3e6, 0xd2f6b4961186fc89, 0x9f8169ba49a54b33, 0x2caf25044a02145c, 0x6b055fede1e5eb68, 0xd82b1353e242b407, 0xe451aa3eb62a1500, 0x577fe680b58d4a6f, 0x10d59c691e6ab55b, 0xa3fbd0d71dcdea34, 0x6820eeb3b6bbf755, 0xdb0ea20db51ca83a, 0x9ca4d8e41efb570e, 0x2f8a945a1d5c0861, 0x13f02d374934a966, 0xa0de61894a93f609, 0xe7741b60e174093d, 0x545a57dee2d35652, 0xe21ac88218962d7a, 0x5134843c1b317215, 0x169efed5b0d68d21, 0xa5b0b26bb371d24e, 0x99ca0b06e7197349, 0x2ae447b8e4be2c26, 0x6d4e3d514f59d312, 0xde6071ef4cfe8c7d, 0x15bb4f8be788911c, 0xa6950335e42fce73, 0xe13f79dc4fc83147, 0x521135624c6f6e28, 0x6e6b8c0f1807cf2f, 0xdd45c0b11ba09040, 0x9aefba58b0476f74, 0x29c1f6e6b3e0301b, 0xc96c5795d7870f42, 0x7a421b2bd420502d, 0x3de861c27fc7af19, 0x8ec62d7c7c60f076, 0xb2bc941128085171, 0x0192d8af2baf0e1e, 0x4638a2468048f12a, 0xf516eef883efae45, 0x3ecdd09c2899b324, 0x8de39c222b3eec4b, 0xca49e6cb80d9137f, 0x7967aa75837e4c10, 0x451d1318d716ed17, 0xf6335fa6d4b1b278, 0xb199254f7f564d4c, 0x02b769f17cf11223, 0xb4f7f6ad86b4690b, 0x07d9ba1385133664, 0x4073c0fa2ef4c950, 0xf35d8c442d53963f, 0xcf273529793b3738, 0x7c0979977a9c6857, 0x3ba3037ed17b9763, 0x888d4fc0d2dcc80c, 0x435671a479aad56d, 0xf0783d1a7a0d8a02, 0xb7d247f3d1ea7536, 0x04fc0b4dd24d2a59, 0x3886b22086258b5e, 0x8ba8fe9e8582d431, 0xcc0284772e652b05, 0x7f2cc8c92dc2746a, 0x325b15e575e1c3d0, 0x8175595b76469cbf, 0xc6df23b2dda1638b, 0x75f16f0cde063ce4, 0x498bd6618a6e9de3, 0xfaa59adf89c9c28c, 0xbd0fe036222e3db8, 0x0e21ac88218962d7, 0xc5fa92ec8aff7fb6, 0x76d4de52895820d9, 0x317ea4bb22bfdfed, 0x8250e80521188082, 0xbe2a516875702185, 0x0d041dd676d77eea, 0x4aae673fdd3081de, 0xf9802b81de97deb1, 0x4fc0b4dd24d2a599, 0xfceef8632775faf6, 0xbb44828a8c9205c2, 0x086ace348f355aad, 0x34107759db5dfbaa, 0x873e3be7d8faa4c5, 0xc094410e731d5bf1, 0x73ba0db070ba049e, 0xb86133d4dbcc19ff, 0x0b4f7f6ad86b4690, 0x4ce50583738cb9a4, 0xffcb493d702be6cb, 0xc3b1f050244347cc, 0x709fbcee27e418a3, 0x3735c6078c03e797, 0x841b8ab98fa4b8f8, 0xadda7c5f3c4488e3, 0x1ef430e13fe3d78c, 0x595e4a08940428b8, 0xea7006b697a377d7, 0xd60abfdbc3cbd6d0, 0x6524f365c06c89bf, 0x228e898c6b8b768b, 0x91a0c532682c29e4, 0x5a7bfb56c35a3485, 0xe955b7e8c0fd6bea, 0xaeffcd016b1a94de, 0x1dd181bf68bdcbb1, 0x21ab38d23cd56ab6, 0x9285746c3f7235d9, 0xd52f0e859495caed, 0x6601423b97329582, 0xd041dd676d77eeaa, 0x636f91d96ed0b1c5, 0x24c5eb30c5374ef1, 0x97eba78ec690119e, 0xab911ee392f8b099, 0x18bf525d915feff6, 0x5f1528b43ab810c2, 0xec3b640a391f4fad, 0x27e05a6e926952cc, 0x94ce16d091ce0da3, 0xd3646c393a29f297, 0x604a2087398eadf8, 0x5c3099ea6de60cff, 0xef1ed5546e415390, 0xa8b4afbdc5a6aca4, 0x1b9ae303c601f3cb, 0x56ed3e2f9e224471, 0xe5c372919d851b1e, 0xa26908783662e42a, 0x114744c635c5bb45, 0x2d3dfdab61ad1a42, 0x9e13b115620a452d, 0xd9b9cbfcc9edba19, 0x6a978742ca4ae576, 0xa14cb926613cf817, 0x1262f598629ba778, 0x55c88f71c97c584c, 0xe6e6c3cfcadb0723, 0xda9c7aa29eb3a624, 0x69b2361c9d14f94b, 0x2e184cf536f3067f, 0x9d36004b35545910, 0x2b769f17cf112238, 0x9858d3a9ccb67d57, 0xdff2a94067518263, 0x6cdce5fe64f6dd0c, 0x50a65c93309e7c0b, 0xe388102d33392364, 0xa4226ac498dedc50, 0x170c267a9b79833f, 0xdcd7181e300f9e5e, 0x6ff954a033a8c131, 0x28532e49984f3e05, 0x9b7d62f79be8616a, 0xa707db9acf80c06d, 0x14299724cc279f02, 0x5383edcd67c06036, 0xe0ada17364673f59 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc64_xz/crc64_xz_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc8.rb000066400000000000000000000037301474611004500215510ustar00rootroot00000000000000require 'digest/crc' module Digest # # Implements the CRC8 algorithm. # class CRC8 < CRC WIDTH = 8 REFLECT_INPUT = false INIT_CRC = 0x00 # Generated by `./pycrc.py --algorithm=table-driven --model=crc-8 --generate=c` TABLE = [ 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3 ].freeze end end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc8/crc8_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/lib/digest/crc8_1wire.rb000066400000000000000000000040071474611004500226560ustar00rootroot00000000000000require 'digest/crc8' module Digest # # Implements the CRC8 1-Wire algorithm. # class CRC8_1Wire < CRC8 # Generated by `./pycrc.py --algorithm=table-driven --model=dallas-1-wire --generate=c` TABLE = [ 0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35 ].freeze end # @deprecated Please use {CRC8_1Wire} instead. CRC81Wire = CRC8_1Wire end if RUBY_ENGINE == 'ruby' begin; require 'digest/crc8_1wire/crc8_1wire_ext'; rescue LoadError; end end postmodern-digest-crc-4adf113/spec/000077500000000000000000000000001474611004500172675ustar00rootroot00000000000000postmodern-digest-crc-4adf113/spec/crc15_spec.rb000066400000000000000000000003001474611004500215340ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc15' describe Digest::CRC15 do let(:string) { '1234567890' } let(:expected) { '178c' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_ccitt_spec.rb000066400000000000000000000003131474611004500227270ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_ccitt' describe Digest::CRC16CCITT do let(:string) { '1234567890' } let(:expected) { '3218' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_genibus_spec.rb000066400000000000000000000003171474611004500232610ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_genibus' describe Digest::CRC16Genibus do let(:string) { '1234567890' } let(:expected) { 'cde7' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_kermit_spec.rb000066400000000000000000000003151474611004500231160ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_kermit' describe Digest::CRC16Kermit do let(:string) { '1234567890' } let(:expected) { '286b' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_modbus_spec.rb000066400000000000000000000003151474611004500231140ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_modbus' describe Digest::CRC16Modbus do let(:string) { '1234567890' } let(:expected) { 'c20a' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_qt_spec.rb000066400000000000000000000003261474611004500222510ustar00rootroot00000000000000require 'spec_helper' require 'digest/crc16_qt' describe "Digest::CRC16QT" do subject { Digest::CRC16QT } it "should be an alias to Digest::CRC16X25" do expect(subject).to be < Digest::CRC16X25 end end postmodern-digest-crc-4adf113/spec/crc16_spec.rb000066400000000000000000000003001474611004500215350ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16' describe Digest::CRC16 do let(:string) { '1234567890' } let(:expected) { 'c57a' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_usb_spec.rb000066400000000000000000000003071474611004500224150ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_usb' describe Digest::CRC16USB do let(:string) { '1234567890' } let(:expected) { '3df5' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_x_25_spec.rb000066400000000000000000000003101474611004500223730ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_x_25' describe Digest::CRC16X25 do let(:string) { '1234567890' } let(:expected) { '4b13' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_xmodem_spec.rb000066400000000000000000000003151474611004500231140ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_xmodem' describe Digest::CRC16XModem do let(:string) { '1234567890' } let(:expected) { 'd321' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc16_zmodem_spec.rb000066400000000000000000000003131474611004500231140ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc16_zmodem' describe Digest::CRC16ZModem do let(:string) { '1234567890' } let(:expected) { 'd321' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc1_spec.rb000066400000000000000000000002721474611004500214570ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc1' describe Digest::CRC1 do let(:string) { '1234567890' } let(:expected) { '0d' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc24_spec.rb000066400000000000000000000003001474611004500215340ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc24' describe Digest::CRC24 do let(:string) { '1234567890' } let(:expected) { '8c0072' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc32_bzip2_spec.rb000066400000000000000000000003151474611004500226470ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32_bzip2' describe Digest::CRC32BZip2 do let(:string) { '1234567890' } let(:expected) { '506853b6' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc32_jam_spec.rb000066400000000000000000000003111474611004500223640ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32_jam' describe Digest::CRC32Jam do let(:string) { '1234567890' } let(:expected) { 'd9e2511a' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc32_mpeg_spec.rb000066400000000000000000000005051474611004500225520ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32_mpeg' describe Digest::CRC32MPEG do let(:string) { '1234567890' } let(:expected) { 'af97ac49' } it_should_behave_like "CRC" end describe "Digest::CRC32Mpeg" do subject { Digest::CRC32Mpeg } it { expect(subject).to eq(Digest::CRC32MPEG) } end postmodern-digest-crc-4adf113/spec/crc32_posix_spec.rb000066400000000000000000000003151474611004500227630ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32_posix' describe Digest::CRC32POSIX do let(:string) { '1234567890' } let(:expected) { 'c181fd8e' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc32_spec.rb000066400000000000000000000003021474611004500215350ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32' describe Digest::CRC32 do let(:string) { '1234567890' } let(:expected) { '261daee5' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc32_xfer_spec.rb000066400000000000000000000003131474611004500225630ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32_xfer' describe Digest::CRC32XFER do let(:string) { '1234567890' } let(:expected) { '0be368eb' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc32c_spec.rb000066400000000000000000000003061474611004500217040ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc32c' describe Digest::CRC32c do let(:string) { '1234567890' } let(:expected) { 'f3dbd4fe' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc5_spec.rb000066400000000000000000000002741474611004500214650ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc5' describe Digest::CRC5 do let(:string) { '1234567890' } let(:expected) { '01' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc64_jones_spec.rb000066400000000000000000000003271474611004500227470ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc64_jones' describe Digest::CRC64Jones do let(:string) { '1234567890' } let(:expected) { '68a745ba133af9bd' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc64_nvme_spec.rb000066400000000000000000000003251474611004500225740ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc64_nvme' describe Digest::CRC64NVMe do let(:string) { '1234567890' } let(:expected) { '6025a582347b79f3' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc64_spec.rb000066400000000000000000000003141474611004500215450ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc64' describe Digest::CRC64 do let(:string) { '1234567890' } let(:expected) { 'bc66a5a9388a5bef' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc64_xz_spec.rb000066400000000000000000000003211474611004500222640ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc64_xz' describe Digest::CRC64XZ do let(:string) { '1234567890' } let(:expected) { 'b1cb31bbb4a2b2be' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc8_1wire_spec.rb000066400000000000000000000005011474611004500225700ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc8_1wire' describe Digest::CRC8_1Wire do let(:string) { '1234567890' } let(:expected) { '4f' } it_should_behave_like "CRC" end describe "Digest::CRC81Wire" do subject { Digest::CRC81Wire } it { expect(subject).to eq(Digest::CRC8_1Wire) } end postmodern-digest-crc-4adf113/spec/crc8_spec.rb000066400000000000000000000002741474611004500214700ustar00rootroot00000000000000require 'spec_helper' require 'crc_examples' require 'digest/crc8' describe Digest::CRC8 do let(:string) { '1234567890' } let(:expected) { '52' } it_should_behave_like "CRC" end postmodern-digest-crc-4adf113/spec/crc_examples.rb000066400000000000000000000033461474611004500222670ustar00rootroot00000000000000require 'spec_helper' shared_examples_for "CRC" do describe ".implementation" do it do expect(described_class.implementation).to be(:pure).or(be(:c_ext)) end end it "should calculate a checksum for text" do expect(described_class.hexdigest(string)).to be == expected end it "should calculate a checksum for multiple data" do middle = (string.length / 2) chunk1 = string[0...middle] chunk2 = string[middle..-1] crc = subject crc << chunk1 crc << chunk2 expect(crc.hexdigest).to be == expected end it "should provide direct access to the checksum value" do crc = subject crc << string expect(crc.checksum).to be == expected.to_i(16) end it "should be the length of the result of pack, based on width, and expressed in big endian" do code = 0xf0f1f2f3f4f5f6f7f8f9fafbfcfdfeff case described_class::WIDTH when 1 # NOTE: The current Digest::CRC1 is an 8-bit checksum, so this code may change in the future digest = "\xff".b when 5 digest = "\x1f".b when 8 digest = "\xff".b when 15 digest = "\x7e\xff".b when 16 digest = "\xfe\xff".b when 24 digest = "\xfd\xfe\xff".b when 32 digest = "\xfc\xfd\xfe\xff".b when 64 digest = "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff".b else raise "Need to enhance specs for unanticipated number of bits (for WIDTH is #{described_class::WIDTH})" end expect(described_class.pack(code)).to be == digest end if defined?(Ractor) it "should calculate CRC inside ractor" do digest = Ractor.new(described_class, string) do |klass, string| klass.hexdigest(string) end.take expect(digest).to eq expected end end end postmodern-digest-crc-4adf113/spec/crc_spec.rb000066400000000000000000000065661474611004500214120ustar00rootroot00000000000000require 'spec_helper' require 'digest/crc' describe Digest::CRC do describe "#block_length" do it { expect(subject.block_length).to be 1 } end describe ".pack" do subject { described_class } it do expect { subject.pack(0) }.to raise_error(NotImplementedError) end end describe "#update" do it do expect { subject.update('') }.to raise_error(NotImplementedError) end end context "when inherited" do subject do Class.new(described_class).tap do |klass| klass::WIDTH = 16 klass::REFLECT_INPUT = true klass::INIT_CRC = 0x01 klass::XOR_MASK = 0x02 klass::TABLE = [0x01, 0x02, 0x03, 0x04].freeze end end it "should override WIDTH" do expect(subject::WIDTH).not_to be described_class::WIDTH end it "should override REFLECT_INPUT" do expect(subject::REFLECT_INPUT).not_to be described_class::REFLECT_INPUT end it "should override INIT_CRC" do expect(subject::INIT_CRC).not_to be described_class::INIT_CRC end it "should override XOR_MASK" do expect(subject::XOR_MASK).not_to be described_class::XOR_MASK end it "should override TABLE" do expect(subject::TABLE).not_to be described_class::TABLE end describe "#initialize" do let(:instance) { subject.new } it "should initialize @init_crc" do expect(instance.instance_variable_get("@init_crc")).to be subject::INIT_CRC end it "should initialize @xor_mask" do expect(instance.instance_variable_get("@xor_mask")).to be subject::XOR_MASK end it "should initialize @width" do expect(instance.instance_variable_get("@width")).to be subject::WIDTH end it "should initialize @reflect_input" do expect(instance.instance_variable_get("@reflect_input")).to be subject::REFLECT_INPUT end it "should initialize @table" do expect(instance.instance_variable_get("@table")).to be subject::TABLE end end end context "when incomplete class with WIDTH to zero" do subject do Class.new(described_class).tap do |klass| klass::WIDTH = 0 klass::REFLECT_INPUT = true klass::TABLE = [1, 2, 3, 4].freeze end end describe "#update" do let(:instance) { subject.new } it "should WIDTH not to be zero" do expect { instance.update "" }.to raise_error(NotImplementedError) end end end context "when incomplete class with REFLECT_INPUT to nil" do subject do Class.new(described_class).tap do |klass| klass::WIDTH = 8 klass::REFLECT_INPUT = nil klass::TABLE = [1, 2, 3, 4].freeze end end describe "#update" do let(:instance) { subject.new } it "should REFLECT_INPUT not to be nil" do expect { instance.update "" }.to raise_error(NotImplementedError) end end end context "when incomplete class with TABLE to empty" do subject do Class.new(described_class).tap do |klass| klass::WIDTH = 8 klass::REFLECT_INPUT = true klass::TABLE = [].freeze end end describe "#update" do let(:instance) { subject.new } it "should TABLE not to be empty" do expect { instance.update "" }.to raise_error(NotImplementedError) end end end end postmodern-digest-crc-4adf113/spec/integration/000077500000000000000000000000001474611004500216125ustar00rootroot00000000000000postmodern-digest-crc-4adf113/spec/integration/docker/000077500000000000000000000000001474611004500230615ustar00rootroot00000000000000postmodern-digest-crc-4adf113/spec/integration/docker/Dockerfile.base000066400000000000000000000002631474611004500257650ustar00rootroot00000000000000ARG RUBY_VERSION=2.7.0 FROM ruby:${RUBY_VERSION}-slim RUN apt-get update -y -qq RUN apt-get install -y -qq bash COPY ./digest-crc.gem . ENTRYPOINT gem install ./digest-crc.gem postmodern-digest-crc-4adf113/spec/integration/docker/Dockerfile.with-gcc000066400000000000000000000000721474611004500265560ustar00rootroot00000000000000FROM test-digest-crc-base RUN apt-get install -y -qq gcc postmodern-digest-crc-4adf113/spec/integration/docker/Dockerfile.with-gcc-and-make000066400000000000000000000000771474611004500302360ustar00rootroot00000000000000FROM test-digest-crc-with-gcc RUN apt-get install -y -qq make postmodern-digest-crc-4adf113/spec/integration/install_spec.rb000066400000000000000000000030141474611004500246150ustar00rootroot00000000000000require 'rspec' describe "installing digest-crc" do ROOT_DIR = File.expand_path('../../..',__FILE__) DOCKER_DIR = File.expand_path('../docker', __FILE__) IMAGES = %w[ test-digest-crc-base test-digest-crc-with-gcc test-digest-crc-with-gcc-and-make ] before(:all) do puts ">>> Building digest-crc gem ..." Dir.chdir(ROOT_DIR) do system 'gem', 'build', '-o', File.join(DOCKER_DIR,'digest-crc.gem'), 'digest-crc.gemspec' end IMAGES.each do |image| suffix = image.sub('test-digest-crc-','') puts ">>> Building #{image} docker image ..." Dir.chdir(DOCKER_DIR) do system "docker build -t #{image} --file Dockerfile.#{suffix} ." end end end context "when installing into a slim environment" do let(:image) { 'test-digest-crc-base' } it "should successfully install digest-crc" do expect(system("docker run #{image}")).to be(true) end end context "when gcc is installed" do let(:image) { 'test-digest-crc-with-gcc' } it "should successfully install digest-crc" do expect(system("docker run #{image}")).to be(true) end end context "when gcc and make are installed" do let(:image) { 'test-digest-crc-with-gcc-and-make' } it "should successfully install digest-crc" do expect(system("docker run #{image}")).to be(true) end end after(:all) do puts ">>> Removing test-digest-crc docker images ..." system "docker image rm -f #{IMAGES.reverse.join(' ')}" end end postmodern-digest-crc-4adf113/spec/spec_helper.rb000066400000000000000000000000641474611004500221050ustar00rootroot00000000000000require 'rspec' require 'simplecov' SimpleCov.start