verhoeff-integrity-engine
Reactive icon

Verhoeff Integrity Engine

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 7 Mar (19 hours ago)
 by 
0.0
 (0 ratings)
verhoeff-integrity-engine

Verhoeff Integrity Engine

Details
This component enables client-side and server-side validation of numeric values using a mathematically robust checksum mechanism called verhoeff algorith
Read more

1. Introduction

The Verhoeff Integrity Engine is an OutSystems Forge component designed to generate and validate Verhoeff check digits for numeric identifiers. The Verhoeff algorithm is a checksum formula that detects common data entry errors, such as:

  • Single-digit errors

  • Adjacent digit transposition

  • Twin errors

This component provides both Client Actions and Server Actions, enabling validation on the UI layer (Reactive Web / Mobile) as well as on the server layer for secure processing.

The component is useful when building applications that require reliable numeric identifiers, such as:

  • Identity numbers

  • Customer IDs

  • Order numbers

  • Ticket numbers

  • Government IDs (e.g., Aadhaar)


2. Component Architecture

The component is divided into two logical modules:

Client-side Module

Library: VerhoeffIntegrityEngine_lib

Provides instant validation and generation within the browser.

Available Client Actions:

ActionPurpose
GenerateVerhoeffNumberGenerates a Verhoeff number
ValidateValidates a Verhoeff number

Server-side Module

Library: VerhoeffIntegrityEngine_Is

Provides backend verification and generation to ensure integrity before database operations.

Available Server Actions:

ActionPurpose
GenerateGenerates Verhoeff number on server
VerifyValidates Verhoeff number on server

3. Algorithm Overview

The Verhoeff algorithm works using three predefined mathematical tables:

Multiplication Table (D)

Defines digit multiplication operations.

Permutation Table (P)

Applies positional permutations to digits.

Inverse Table (Inv)

Used to compute the check digit.

The algorithm processes numbers right-to-left and computes a checksum value.

If the checksum equals 0, the number is valid.


4. Client Actions

Client actions allow real-time validation and generation inside UI logic without server calls.

Location:

Client Actions + VerhoeffIntegrityEngine_lib + GenerateVerhoeffNumber + Validate

4.1 GenerateVerhoeffNumber

Description

Generates a Verhoeff check digit for a numeric value and returns the full number including the check digit.

This action is typically used when creating new identifiers in forms.


Input Parameters

ParameterTypeDescription
LengthIntegerLength of the base number

Output Parameters

ParameterTypeDescription
GeneratedVerhoeffNumberTextGenerated number including Verhoeff check digit

Example

Input:

Length = 5

Output:

GeneratedVerhoeffNumber = 483921

Where:

48392 = base number 1 = Verhoeff check digit

Usage Example

Button Generate ID ? GenerateVerhoeffNumber ? Display GeneratedVerhoeffNumber

4.2 Validate

Description

Validates whether a given number contains a correct Verhoeff check digit.

Used for client-side form validation.


Input Parameters

ParameterTypeDescription
InputAsTextTextNumber containing Verhoeff check digit
lengthIntegerExpected length of the number

Output Parameters

ParameterTypeDescription
IsvalidBooleanIndicates if the number is valid

Example

Input:

InputAsText = 483921 Length = 6

Output:

Isvalid = True

Invalid Example:

483922 ? False

5. Server Actions

Server actions perform secure validation and generation on the backend, ensuring data integrity before saving records.

Location:

Server Actions + VerhoeffIntegrityEngine_Is + Generate + Verify

5.1 Generate

Description

Generates a Verhoeff number on the server side.

This action is recommended when generating identifiers before inserting records into a database.


Input Parameters

ParameterTypeDescription
LengthIntegerDesired length of the number

Output Parameters

ParameterTypeDescription
GeneratedVerhoeffNumberTextGenerated number with Verhoeff check digit

Example

Input:

Length = 7

Output:

GeneratedVerhoeffNumber = 8392746

Typical Flow

Create Record ? Generate ? Assign Identifier ? Insert Record

5.2 Verify

Description

Verifies whether a number is valid according to the Verhoeff algorithm.

Used in backend validation workflows.


Input Parameters

ParameterTypeDescription
NumbertextTextNumber including check digit

Output Parameters

ParameterTypeDescription
IsValidBooleanTrue if number is valid

Example

Input:

Numbertext = 8392746

Output:

IsValid = True

6. Typical Implementation

Client-side Validation

User enters ID ? Validate (Client Action) ? If valid ? Submit form Else ? Show validation error

Server-side Validation

Submit Form ? Verify (Server Action) ? If valid ? Save Record Else ? Reject Request

7. Error Handling

The component handles the following conditions:

ScenarioBehaviour
Non-numeric inputValidation fails
Incorrect lengthValidation fails
Invalid check digitReturns false

Recommended validation before execution:

IsNumeric(Input) AND Length(Input) > 1

8. Performance Considerations

  • Client actions execute instantly in the browser

  • Server actions ensure secure backend validation

  • Recommended approach:

Client Validation + Server Validation

9. Security Considerations

Although the Verhoeff algorithm helps detect data entry errors, it does not provide cryptographic security.

Therefore it should not be used for security-sensitive validation such as:

  • Password protection

  • Encryption

  • Secure tokens


10. Supported Platforms

PlatformSupported
Reactive Web AppsYes
Mobile AppsYes
Traditional WebYes
OutSystems Version11

11. Use Cases

The Verhoeff Integrity Engine can be used in systems requiring reliable numeric identifiers, including:

  • Customer IDs

  • Transaction IDs

  • Ticket numbers

  • Government identifiers

  • Invoice numbers

  • Order numbers


12. Best Practices

Recommended usage pattern:

Client validation ? Immediate feedback Server validation ? Final verification

Always ensure:

  • Input contains only numeric characters

  • Correct identifier length is enforced

  • Server validation is executed before saving data

Release notes (1.0.0)
License (1.0.0)
Reviews (0)
Team
Other assets in this category