Luhn Mod N in Cache?
Hi all
I'm trying to recreate this method below in Cache/IRIS.
https://en.wikipedia.org/wiki/Luhn_mod_N_algorithm ISO-7812-1 (LUHN-10)
I've been following the javascript example. It seems simple in theory but i'm struggling with which cache methods to pick.
$LENGTH, $System.SQL.FLOOR() - seem ok
$EXTRACT - I think for .charAt (though may need to correct base)
$FIND - for .indexOf
Any suggestion which would be the best ones for the job?
Thanks
Dan
Product version: IRIS 2019.1
$ZV: IRIS for Windows (x86-64) 2019.1.1 (Build 615_1_20704U) Thu Mar 18 2021 15:49:22 EDT
Is this, what are you looking for?
https://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#MUMPS
Check out
$system.Encryption. LuhnCheckSum()
and
$system.Encryption.LuhnValidate()
Hi. Thanks for your tips! Though it has to be Mod N version which is an extension that supports non-numerical strings.
I guess I can use a proxy class to get the result but it would be nice to do this natively in Cache/MUMPS. What I will say is this: the need to do this it is going to be very important for others I expect also. A bit more info about why it is needed is below, with the character set needed to create codepoints from.
Link
Hi Dmitry
Ahhh. I can see why my loop with the find wasn't working as I expected. Thank you so much for providing this example.
Dan