Technical Article

Script to get Phonetic Pronunciation of a given password

,

Just set the @pwdstr at the beginning of the script to the password you want the phonetics displayed and just run it. It uses a temp table.

/*------------------------------------------------------------

A simple script to display phonetic pronunciation of a given password 

-- Assumption: Server is case-insensitive


-- by Vijay Anisetti
-- Mar 12, 2010

--------------------------------------------------------------*/
SET NOCOUNT ON
declare @basestr varchar(500) 
declare @stripstr varchar(500)
declare @pwdstr varchar(50)
declare @cfill varchar(3)
declare @i int
declare @cpos int
declare @pwords int

if exists(select * From tempdb.sys.objects where [name] like '%#t1%') drop table #t1

/* set the password string below before you run */set @pwdstr = 'YourPasswordGoesHere'

create table #t1( cnum int, cchar varchar(20) COLLATE Latin1_General_CS_AS )

set @i = 1
while @i < 255
begin
set @cfill = char(@i)

insert #t1 values (@i, @cfill )

set @i = @i +1
end

set @basestr = ' 0-zero 1-one 2-two 3-three 4-four 5-five 6-six 7-seven 8-eight 9-nine Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey Xray Yankee Zulu alpha bravo charlie delta echo foxtrot golf hotel india juliet kilo lima mike november oscar papa quebec romeo sierra tango uniform victor whiskey xray yankee zulu '
set @i = charindex (' ',@basestr )
set @pwords = 62

while @pwords > 0
begin
set @cpos = charindex(' ',@basestr ,charindex (' ',@basestr )+1)
set @stripstr = substring(@basestr ,@i+1,@cpos-1)

update #t1 
    set cchar = @stripstr
where cchar = left(@stripstr,1)

set @basestr = substring(@basestr ,@cpos, 1000)
set @i = charindex (' ',@basestr )
set @pwords = @pwords - 1

end

set @stripstr = ''
set @i = 1

while @i <= len(@pwdstr)
begin
    select @basestr = cchar from #t1 where ascii(substring(@pwdstr,@i,1)) = cnum
    set @stripstr = @stripstr+ ' '+@basestr 
    set @i = @i +1
end

-- print phonetics
print 'password: '+@pwdstr
print @stripstr

-- drop temp table
if exists(select * From tempdb.sys.objects where [name] like '%#t1%') drop table #t1

Rate

3.4 (5)

You rated this post out of 5. Change rating

Share

Share

Rate

3.4 (5)

You rated this post out of 5. Change rating