Skip to content

A SQLServer User-Defined function for checking and creating the Verhoeff check digit.

License

Notifications You must be signed in to change notification settings

rstens/verhoeff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Verhoeff Algorithm Implementations

Wikipedia was updated to remove all the implementation links, so for completeness sake they are here now:

Introduction

I have created a SQLServer User-Defined function for checking and creating the Verhoeff check digit.

See WikiPedia:Verhoeff_algorithm

The Verhoeff algorithm, a checksum formula for error detection first published in 1969, was developed by Dutch mathematician Jacobus Verhoeff (born 1927). Like the more widely known Luhn algorithm, it works with strings of decimal digits of any length. It does a better job than the Luhn algorithm, though, in that it will detect all "transposition" errors (switching of two adjacent digits), as well as catching many other types of errors that pass the Luhn formula undetected.

Usage

/* Usage for checking the validity of a number:*/
SELECT dbo.checksumVerhoeff([number TO be checked],0) <FROM [your TABLE]>


/*Usage for creating a check digit for a number:*/
SELECT dbo.checksumVerhoeff([your number],1) <FROM [your TABLE]>

About

A SQLServer User-Defined function for checking and creating the Verhoeff check digit.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published