| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Encrypts a character string.
HB_Crypt( <cString>, <cKey> ) --> cEncryptedString
The function returns the encrypted character string.
Function HB_Crypt() encrypts a character string using the encryption key <cKey>. The key should have at least six characters and cannot be longer than 512 characters. The returned encrypted string can be decrypted by passing it to function HB_Decrypt() along with the same encryption key.
| See also: | HB_Decrypt() |
| Category: | Character functions , Conversion functions , xHarbour extensions |
| Source: | rtl\hbcrypt.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows how to encrypt a decrypt a character string.
PROCEDURE Main
LOCAL cText := "Hello world"
LOCAL cKey := "xHarbour"
LOCAL cCipher
cCipher := HB_Crypt( cText, cKey )
? cCipher
? HB_Decrypt( cCipher, cKey )
RETURN
http://www.xHarbour.com