DynDeveloper.com

DynDeveloper.com

GuestLog Out
You are accessing the Members Only area for DynDeveloper.com using guest access. The member experience is slightly different
RachelW 4/25/2019 10:44:10 AM

Decrypt Dynamics GP Password

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

This stored proc will decrypt Dynamics GP passwords. Use this code to test. 

DECLARE @p binary(100)
SELECT @p = password from dynamics..sy02400
exec dd_Dynamics_Decrypt @p

 

4Penny.net
Version: All
Section: SQL Scripts
IF exists (select * from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = 'dd_Dynamics_Decrypt') begin
    DROP proc dd_Dynamics_Decrypt
end
GO
  
CREATE proc dd_Dynamics_Decrypt
  
@Password binary(100)
/*
TO TEST, RUN THIS CODE
 
DECLARE @p binary(100)
SELECT @p = password from dynamics..sy02400
exec dd_Dynamics_Decrypt @p
*/
  
AS
/*
Written by Steve Gray, www.DynDeveloper.com, steve@4Penny.net
Free to distribute and reuse
Please do not remove this banner
*/
set transaction isolation level read uncommitted
  
if len(@Password) = 0 begin
    select '' as Password
    return
end
declare @passChars varchar(100) = substring(master.dbo.fn_varbintohexstr(@Password), 1, 22)
declare @out varchar(50) = ''
declare @chr varchar(2)
declare @len int = len(@passChars)
declare @a int = 0
while @a < @len begin
    set @chr = left(@passChars,2)
    set @passChars = SUBSTRING(@passChars,3,99)
      
    set @out = @out + case
        when @chr = '0x' then ''  
        when @chr = 'DF' then '1' 
        when @chr = 'DC' then '2' 
        when @chr = 'DD' then '3' 
        when @chr = 'DA' then '4' 
        when @chr = 'DB' then '5' 
        when @chr = 'D8' then '6' 
        when @chr = 'D9' then '7' 
        when @chr = 'D6' then '8' 
        when @chr = 'D7' then '9' 
  
        when @chr = 'AF' then 'A' 
        when @chr = 'AC' then 'B' 
        when @chr = 'AD' then 'C' 
        when @chr = 'AA' then 'D' 
        when @chr = 'AB' then 'E' 
        when @chr = 'A8' then 'F' 
        when @chr = 'A9' then 'G' 
        when @chr = 'A6' then 'H' 
        when @chr = 'A7' then 'I' 
        when @chr = 'A4' then 'J' 
        when @chr = 'A5' then 'K' 
        when @chr = 'A2' then 'L' 
        when @chr = 'A3' then 'M' 
        when @chr = 'A0' then 'N' 
        when @chr = 'A1' then 'O' 
        when @chr = 'BE' then 'P' 
        when @chr = 'BF' then 'Q' 
        when @chr = 'BC' then 'R' 
        when @chr = 'BD' then 'S' 
        when @chr = 'BA' then 'T' 
        when @chr = 'BB' then 'U' 
        when @chr = 'B8' then 'V' 
        when @chr = 'B9' then 'W' 
        when @chr = 'B6' then 'X' 
        when @chr = 'B7' then 'Y' 
        when @chr = 'B4' then 'Z'
  
        when @chr = '8F' then 'a' 
        when @chr = '8C' then 'b' 
        when @chr = '8D' then 'c' 
        when @chr = '8A' then 'd' 
        when @chr = '8B' then 'e' 
        when @chr = '88' then 'f' 
        when @chr = '89' then 'g' 
        when @chr = '86' then 'h' 
        when @chr = '87' then 'i' 
        when @chr = '84' then 'j' 
        when @chr = '85' then 'k' 
        when @chr = '82' then 'l' 
        when @chr = '83' then 'm' 
        when @chr = '80' then 'n' 
        when @chr = '81' then 'o' 
        when @chr = '9E' then 'p' 
        when @chr = '9F' then 'q' 
        when @chr = '9C' then 'r' 
        when @chr = '9D' then 's' 
        when @chr = '9A' then 't' 
        when @chr = '9B' then 'u' 
        when @chr = '98' then 'v' 
        when @chr = '99' then 'w' 
        when @chr = '96' then 'x' 
        when @chr = '97' then 'y' 
        when @chr = '94' then 'z'
        when @chr = 'CF' then '!' 
        when @chr = 'AE' then '@' 
        when @chr = 'CD' then '#' 
        when @chr = 'CA' then '$' 
        when @chr = 'CB' then '%' 
        when @chr = 'B0' then '^' 
        when @chr = 'C8' then '&' 
        when @chr = 'C4' then '*' 
        when @chr = 'C6' then '(' 
        when @chr = 'C7' then ')' 
        when @chr = 'CE' then ' ' 
        when @chr = '20' then ''  
        when @chr = '00' then ''  
        when @chr = 'C3' then '-' 
        when @chr = 'B1' then '_' 
        when @chr = 'D3' then '=' 
        when @chr = 'C5' then '+' 
        when @chr = 'B5' then '[' 
        when @chr = 'B3' then ']' 
        when @chr = '95' then '{' 
        when @chr = '93' then '}' 
        when @chr = 'B2' then '=' 
        when @chr = '92' then '|' 
        when @chr = 'D5' then ';' 
        when @chr = 'D4' then ':' 
        when @chr = 'C9' then ''  
        when @chr = 'CC' then '"' 
        when @chr = 'C2' then '=' 
        when @chr = 'D2' then '<' 
        when @chr = 'C0' then '.' 
        when @chr = 'D0' then '>' 
        when @chr = 'C1' then '/' 
        when @chr = 'D1' then '?' 
        when @chr = '8E' then '`' 
        when @chr = '90' then '~' 
        --else '?' + @chr + '?' end
        else '' end
    set @a = @a + 1
end
  
select @out as Password
  
  
  
  
GO
  
GRANT EXEC ON dd_Dynamics_Decrypt TO PUBLIC

Add a Comment



Not Subscribed. You will not receive emails on article changes or comment additions

Comments

body header
No records to display.