xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_Crypt()

Encrypts a character string.

Syntax

HB_Crypt( <cString>, <cKey> ) --> cEncryptedString

Arguments

<cString>
This is a character string to encrypt.
<cKey>
This is a character string holding the encryption key.

Return

The function returns the encrypted character string.

Description

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.

Info

See also:HB_Decrypt()
Category: Character functions , Conversion functions , xHarbour extensions
Source:rtl\hbcrypt.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe