Sha256: 6be608c8df8e18ec55240c1292c8e85a59950bf6397bdcd24e1778a9b66a2cf9
Contents?: true
Size: 341 Bytes
Versions: 16
Compression:
Stored size: 341 Bytes
Contents
class Valvat module Checksum class DE < Base M = 10 N = 11 def check_digit prod = M figures.each do |fig| sum = (prod + fig).modulo(M) sum = M if sum == 0 prod = (2*sum).modulo(N) end chk = N - prod chk == 10 ? 0 : chk end end end end
Version data entries
16 entries across 16 versions & 1 rubygems