Sha256: f35ddc20c9df0cd845ea9e4325b6523e0b5f359b4b45f782063c91402e3de91f

Contents?: true

Size: 305 Bytes

Versions: 9

Compression:

Stored size: 305 Bytes

Contents

# frozen_string_literal: true

class Valvat
  module Checksum
    class HU < Base
      def check_digit
        multipliers = [3, 7, 9, 1, 3, 7, 9]

        sum = sum_figures_by do |digit, index|
          digit * multipliers[index]
        end

        (10 - (sum % 10)) % 10
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
valvat-1.4.4 lib/valvat/checksum/hu.rb
valvat-1.4.3 lib/valvat/checksum/hu.rb
valvat-1.4.2 lib/valvat/checksum/hu.rb
valvat-1.4.1 lib/valvat/checksum/hu.rb
valvat-1.4.0 lib/valvat/checksum/hu.rb
valvat-1.3.0 lib/valvat/checksum/hu.rb
valvat-1.2.1 lib/valvat/checksum/hu.rb
valvat-1.2.0 lib/valvat/checksum/hu.rb
valvat-1.1.5 lib/valvat/checksum/hu.rb