Created
March 27, 2022 08:40
-
-
Save somendra007/4e4c8cba8426dc97f064eaee4a4beb25 to your computer and use it in GitHub Desktop.
EncryptPassword Procedures
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
----------------------------------------------------------------- | |
CREATED BY : Somendra Pratap Singh | |
PURPOSE : Encrypt password | |
select dbo.EncryptPassword('STR112') | |
select * from SRVUserLogin where logname = 'STR112' | |
select * from SRVPasswordPolicy where employeeid = '2964' | |
------------------------------------------------------------------ | |
CREATE FUNCTION EncryptPassword(@pstrtext VARCHAR(50)) | |
RETURNS VARCHAR(50) | |
BEGIN | |
Declare @liLength INT; | |
Declare @liCtr INT; | |
Declare @liAscii INT | |
Declare @lstrTemp varchar(50); | |
Declare @lstrEncryptText As varchar(50)= ''; | |
SET @liLength = LEN(@pstrtext); | |
SET @liCtr = 1; | |
WHILE @liCtr <= @liLength | |
BEGIN | |
SET @lstrTemp = SUBSTRING(@pstrtext, @liCtr, 1); | |
SET @liAscii = ASCII(@lstrTemp); | |
SET @liAscii = @liAscii + 10; | |
SET @liAscii = @liAscii * 2; | |
SET @lstrEncryptText = @lstrEncryptText + CAST(@liAscii AS VARCHAR(5)) + '/'; | |
SET @liCtr += 1; | |
END | |
RETURN @lstrEncryptText; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment