ng:checksum

ng:checksum

The built in function, ng:checksum(InputText,Method) returns the calculated checksum for a text input (InputText) and a given method (Method). Please note, that the function returns the checksum only and not the InputText with the added checksum.

The function has these two input parameters:

TextToEncrypt
This first parameter is the input text for which the checksum is to be calculated. This must be a string, which means, that if you want to use a number as input, then you need either to delimit the number with single or double quotes or use the string function to convert the number into a string.

Method
The method of checksum to use. 
These methods can be used:
(The value must be written in lower case exactly as shown below.)

Value
Short description
Additional description
Example
mod10
Modulus 10 / Luhn formula
Used in credit cards checksums, IMEI for preventing accidental typing errors. ISO/IEC 7812-1
ng:checksum('123456789','mod10') 
returns 7
pzn
Modulus 11 / PZN PharmaZentralNummer
Used for pharmaceutical products.
ng:checksum('1234567','pzn')
returns 3
isbn10
Modulus 11 / ISBN 10 - International standard book number
Identifies a book by 9 digits and a control digit.
ng:checksum('034539180','isbn10')
returns 2

isbn13
EAN13 / ISBN 13 - International standard book number
Identifies a book by 12 digits and a control digit. This is identical to an EAN 13 checksum and can be used in an EAN 13 barcode. (ISBN10 and ISBN13 are currently interchangeable numbers)
ng:checksum('978034539180','isbn13')
returns 3
issn
ISSN / International standard serial number
Represents periodical items, like a magazine, newspaper
ng:checksum('0360528','issn')
returns 0
mod43
Modulo43
Often used in code39 barcodes
ng:checksum('1234567AB','mod43')
Returns 6
crc32
CRC-32 / ISO-HDLC Cyclic redundancy check
Used as integrity test of data,  specially in from volatile medias or in zip files.
ng:checksum('ABCDEFGHIJKLMN','crc32')
Returns 2871390021 (always a 32 bit number)
md5
MD5 / Message-digest algorithm
Used for data verification and is modified checks. Historically used for password encryption (Unsafe for security purposes)
ng:checksum('ABCDEFGHIJKLMN','md5')
Returns 47e441c9bbd571f97fc86c5be32f6cc0 (Hex representation of bytes)
sha1
SHA1 / Secure Hash Algorithm 1
Used for data verification (In GitHub and other places. Historically used for password encryption (Considered unsafe today, but requires a lot of CPU power to break)
ng:checksum('ABCDEFGHIJKLMN','sha1')
Returns 6238bf61dd8df8f77156b2378e9e39cd3939680c (Hex representation of bytes)
sha256
SHA256 / Secure Hash Algorithm 2 (256)
Used for password encryption, considered safe.
ng:checksum('ABCDEFGHIJKLMN','sha256')
Returns: 93c5f007220b38ab257456a0e96540d148d4425cf91569dbcdfe6b72685538a4 (Hex representation of bytes)
fik
FIK - Fælles indbtalingskort (Common payment slip)
The Danish Giro kort / indbetalingskort payment slip system.
ng:checksum('00000000404066','fik')
Returns 3

    • Related Articles

    • ng:decrypt

      The built-in function, ng:decrypt is linked with the encryption functions: ng:encrypt and the workflow component, Set secure workflow variable. The function, ng:decrypt() can decrypt contents, that was previously encrypted with these functions. The ...
    • ng:resourceExist

      This function checks, if a resource in InterFormNG2 exists or not. The function returns a boolean: true or false. The ng:resourceExist Xpath function has this format: ng:resourceExist(resource,path) where: resource Resource is the type of resource in ...
    • ng:minimum

      InterFormNG2 includes the special built-in XPath function, ng:minimum. This function returns the smallest value of two numeric arguments. The function only accepts two numeric arguments - no more and no less. Examples: ng:minimum(-14,2) returns: -14 ...
    • ng:base64

      The built-in function, ng:base64() converts a string (text) into a base64 based string. This can e.g. be used, if you want to insert any kind of data into an XML node, without substituting any characters, that are not allowed. This function is ...
    • ng:spaceConcat

      The built-in function, ng:spaceConcat(), helps concatenate two strings with a space character automatically inserted between them. Here is an example: This XPath expression: ng:spaceConcat('First name:', 'Jon') outputs this string: First name: Jon ...