Call now: (800) 766-1884  


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA

 SQL Server Scripts
 Scripts Menu




  SQL Server Tips by Gama and Naughter

Helix Stream Cipher

Helix is a high-speed cipher developed by Niels Ferguson, Doug Whiting, Bruce Schneier, John Kelsey, Stefan Lucks, and Tadayoshi Kohno. It includes encryption / decryption and a Message Authentication Code (MAC) in the one algorithm. It incorporates a 128-bit key and is designed to operate quickly on modern CPUís such as a Pentium 2 and later. Because the MS CryptoAPI does not include support for this algorithm, we must implement support directly for it in XP_CRYPTOAPI. A C++ implementation of the algorithm is available from PJís web site at and we simply incorporate this code directly into the XP_CRYPTOAPI code. Because it includes hashing as well as encryption, the parameters to the Helix XPís are different than the MS CryptoAPI examples provided so far. For encryption we have an additional output parameter, which contains the MAC. For decryption, this MAC becomes an additional input parameter. The code continues to use the CryptoAPI to create the contents for the key from the password parameter. The key is setup using the following code:

BYTE* pHashData = (BYTE*) _alloca(dwHashSize);
if (CryptGetHashParam(hHash, HP_HASHVAL, pHashData, &dwHashSize, 0))
CHelix helix;
helix.SetKey(pHashData, dwHashSize);

The encryption process is implemented by calling the ĎCHelix::Encryptí method as follows:

helix.Encrypt(m_pParameterData[HELIX_ENCRYPT_DATA_TO_ENCRYPT_INDEX].m_pData, m_pParameterData[HELIX_ENCRYPT_DATA_TO_ENCRYPT_INDEX].m_cbActualLen, nonce, pbyEncryptedData, mac)

The decryption XP is implemented using similar code.

The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter  


Burleson Consulting Remote DB Administration







Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.

Burleson Consulting
SQL Server database support


Copyright © 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter