01-14-2006, 11:38 PM
Zack, you've gotten me hooked on neat little encryption methods. Here's one I just finished. It's sort of like a combination of your original algorithm, with Winer's. Here's the procedure:
Basically, it works like Winer's by overlaying the key across the original, but mine overlaps the key, essentialy producing the same effect as the method you originally posted, but with the first len(key)-1 characters being encrypted differently. I'm not an expert, but I suppose that for this type of encryption you mght as well employ your algorithm, but I think the function looks neat nonetheless. Here is the code:
Code:
'' original
'' ^^^
'' key^
'' key^
'' key^
'' key^
'' key^
'' key
'' ke
'' k
Code:
option explicit
option byval
function StylinizeText( byref text as string, byref key as string ) as string
if( strptr(text)=0 ) then return ""
if( strptr(key)=0 ) then return text
dim as string result => text
dim as integer resIndex = 0, resLength = len(result), keyLength = len(key)
while( resIndex < resLength )
dim as integer keyIndex = 0
while( (keyIndex < keyLength) and ((resIndex + keyIndex) < resLength) )
result[resIndex + keyIndex] xor= key[keyIndex]
keyIndex += 1
wend
resIndex += 1
wend : return result
end function
function deStylinizeText( byref text as string, byref key as string ) as string
return StylinizeText( text, key )
end function
stylin: