Encrypts a number given a seed number

Applies to:

Win32, Win64


Declare Func pp_nencrypt(ByVal number As Long, ByVal seed As Long) As Long


LONG pp_nencrypt(LONG number, LONG seed)


<number> is the number to be encrypted, between 0 and 16,383 (14 bits)

<seed> is the seed number used to encrypt the number, between 0 and 255


A value representing the encrypted number. -1 is returned if a <number> greater than 16,383 is passed. Any <seed> passed greater than 255 will be truncated automatically to the first hexadecimal byte of the number. This is handy when the computer ID number algorithm is used as the seed. This makes each installation of your application use a different seed for encrypting numbers.


Used to encrypt a number based upon a given user-definable <seed> number. This function is typically used when it is necessary to send a given number to a remote workstation such as a new number of allowed workstations. It is possible to give the user a several digit number that represents the encrypted number. The user is not able to determine the algorithm used to change the decrypted value used by the application.


' We will encrypt a number using the computer number

' as a seed. Even though the computer number is greater

' than 255 it will be truncated.

Dim EncryptedNum As Long, DecryptedNum As Long

Dim compno As Long

compno = pp_compno(1, "", "")

EncryptedNum = pp_nencrypt(25,compno)


DecryptedNum = pp_ndecrypt(EncryptedNum, compno)

' DecryptedNum now equals 25

See Also:


Concept Link IconRelated Topics