Sha256: 163dc3d5b1165d29ad08f2d17b8129881e419dfc9537640c60dfba137ec9d8dc

Contents?: true

Size: 303 Bytes

Versions: 5

Compression:

Stored size: 303 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

5 entries across 5 versions & 1 rubygems

Version Path
valvat-1.1.4 lib/valvat/checksum/hu.rb
valvat-1.1.3 lib/valvat/checksum/hu.rb
valvat-1.1.2 lib/valvat/checksum/hu.rb
valvat-1.1.1 lib/valvat/checksum/hu.rb
valvat-1.1.0 lib/valvat/checksum/hu.rb