Created
August 18, 2023 14:41
-
-
Save ststeiger/e25b1bad2fc95ae7c190a539ba227a41 to your computer and use it in GitHub Desktop.
Crypt vs. Plain - text length comparison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SELECT dbo.AesEncrypt(''), dbo.AesDecrypt('615ca4a4b3e23e5b500ff7352a519e39') | |
-- SELECT dbo.DesEncrypt('test'), dbo.DesDecrypt('WNSw7KxMxW4=') | |
;WITH CTE_PlainText AS | |
( | |
SELECT i, REPLICATE('A', i) AS plainText FROM tfu_RPT_All_Interval(0, 99,1) | |
) | |
,CTE AS | |
( | |
SELECT | |
CTE_PlainText.* | |
,dbo.DesEncrypt(plainText) AS cipherText | |
FROM CTE_PlainText | |
) | |
,LOL AS ( | |
SELECT | |
CTE.* | |
,LEN(CTE.plainText) AS plainLength | |
,LEN(CTE.cipherText) AS cipherLength | |
,LEN(CTE.plainText)/8 +1 as block | |
FROM CTE | |
) | |
SELECT | |
block | |
,MIN(plainLength) AS plainLength_MIN | |
,MAX(plainLength) AS plainLength_MAX | |
,MIN(cipherLength) AS cipherLength | |
FROM LoL | |
GROUP BY block |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment