Programming & Software Support
- Enabling SMS Feature for China Unicom VN007+ 5G Modem
- Generating Running Balance or Statement of Acount in SQL
- Model Binded Custom HTML Helper for C# MVC
- Easyworship 2009 fix for Windows 10 Nov. 2015 Update
- Simple way of encrypting and decrypting sensitive data using phrase
- HTML Color Chart
- Getting The Last Column Of The Last Row Of A Table with jQuery
- Microsoft SQL Server Transactional and Merge Replication step by step
- Check for duplicates before inserting a record
- Creating Stored Procedure with Output Variable
Categories
table variable, ENCRYPTBYPASSPHRASE, DECRYPTBYPASSPHRASE
DECLARE @key varchar(50) = 'fGsltwtHgHobStwbiHsnpbhelj316'
, @cardNumber varchar(max) = '537153001234567890'
DECLARE @creditCards TABLE (
OwnerId BIGINT
, CardNumber VARBINARY(MAX)
)
INSERT INTO @creditCards
(ownerId, cardNumber)
SELECT 1
, ENCRYPTBYPASSPHRASE (@key, @cardNumber )
SELECT OwnerId
, CardNumber as 'EncryptedCardNumber'
, CONVERT (varchar(max), DECRYPTBYPASSPHRASE (@key, cardNumber ) ) AS 'DecryptedCardNumber'
FROM @creditCards
And here's our output:
OwnerId EncryptedCardNumber DecryptedCardNumber
1 0x01000000A507E0A9A 537153001234567890
45A5C80E46734197C4D
BA44929625CC11A754F
618086BD4DE4A976D84
A8ACFDDB71D5A3
Back To Programming & Software Support