Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Node.js) Match MySQL AES_ENCRYPT FunctionDemonstrates how to use the MySqlAesEncrypt and MySqlAesDecrypt methods to match MySQL's AES_ENCRYPT and AES_DECRYPT functions. Here are MySQL AES_ENCRYPT test vectors: HEX(AES_ENCRYPT('The quick brown fox jumps over the lazy dog','password')) Output: CC5FDDF621AE2F48241BB80EDF2422949526FBAAA74885ACB020A74CAAB98BCFA1DD12E5D4C7922A2F9205D367921D9B HEX(AES_ENCRYPT('The quick brown fox jumps over the lazy dog','a')) Output: 47A7E5FB591AD818BA3C9025D040514696BF50C2EFB0A453730E23E824F5F0357F3F673FCF0A7BD16465E82F937ED365 HEX(AES_ENCRYPT('The quick brown fox jumps over the lazy dog','1234567890123456')) Output: D70F1A158553B721C5DB9220A627E7B17BFF78FF7A72C4AB565AC903A94DF76DB75A30583D4ED01E265147D5A9B04EC3 HEX(AES_ENCRYPT('The quick brown fox jumps over the lazy dog','abcdefghijklmnopqrstuvwxyz')) Output: 425F259AD4C3DD0B37831C8F24507D7E1F056437C0D50D3C18FB6F600FC941A8D871E7DD7BCBEE4CA4698F074C135275
var os = require('os'); if (os.platform() == 'win32') { if (os.arch() == 'ia32') { var chilkat = require('@chilkat/ck-node21-win-ia32'); } else { var chilkat = require('@chilkat/ck-node21-win64'); } } else if (os.platform() == 'linux') { if (os.arch() == 'arm') { var chilkat = require('@chilkat/ck-node21-arm'); } else if (os.arch() == 'x86') { var chilkat = require('@chilkat/ck-node21-linux32'); } else { var chilkat = require('@chilkat/ck-node21-linux64'); } } else if (os.platform() == 'darwin') { if (os.arch() == 'arm64') { var chilkat = require('@chilkat/ck-node21-mac-m1'); } else { var chilkat = require('@chilkat/ck-node21-macosx'); } } function chilkatExample() { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. var crypt = new chilkat.Crypt2(); var clearText = "The quick brown fox jumps over the lazy dog"; var password; var hexEncryptedStr; var decryptedStr; password = "password"; hexEncryptedStr = crypt.MySqlAesEncrypt(clearText,password); console.log(hexEncryptedStr); decryptedStr = crypt.MySqlAesDecrypt(hexEncryptedStr,password); console.log(decryptedStr); password = "a"; hexEncryptedStr = crypt.MySqlAesEncrypt(clearText,password); console.log(hexEncryptedStr); decryptedStr = crypt.MySqlAesDecrypt(hexEncryptedStr,password); console.log(decryptedStr); password = "1234567890123456"; hexEncryptedStr = crypt.MySqlAesEncrypt(clearText,password); console.log(hexEncryptedStr); decryptedStr = crypt.MySqlAesDecrypt(hexEncryptedStr,password); console.log(decryptedStr); password = "abcdefghijklmnopqrstuvwxyz"; hexEncryptedStr = crypt.MySqlAesEncrypt(clearText,password); console.log(hexEncryptedStr); decryptedStr = crypt.MySqlAesDecrypt(hexEncryptedStr,password); console.log(decryptedStr); } chilkatExample(); |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.