B4A Library XTEA encryption and decryption lib

Since the Shoutcast server protocol Ultravox2.1 requires the XTEA encryption for clients and sources to log in to password protected servers , i decided to write a little lib to make it easier to encrypt and decrypt those strings.

The usage is pretty easy!

B4X:
Sub Process_Globals
Dim XT As XTEA
End Sub


Sub CryptSomeStuff()

Dim s As String
'crypt
s=XT.Crypt("lolkey","lolpassword",False)

'decrypt
s=XT.Crypt("lolkey",s,True)
's should be "lolpassword"again
End Sub

Sub XTEACrypt(key As String , s As String )As String
Return XT.Crypt(s,key,False)
End Sub
Sub XTEADecrypt(key As String , s As String )As String
Return XT.Crypt(s,key,True).Trim
End Sub
 

Attachments

  • XTEA.zip
    4 KB · Views: 311

DarkPixel

New Member
Licensed User
Longtime User
Works great man, thanks for the library :sign0098:
(BTW, why the 16 char limit?)
 
Last edited:

P373R

Member
Licensed User
Longtime User
xtea works that way .. it encrypts by using 16 byte blocks but is much faster then md5 or sha1 .. you can use a loop to encrypt more ;>

i just ported it here to be able to create a android winamp server .. didnt implemented any full text functions.
 

DarkPixel

New Member
Licensed User
Longtime User
xtea works that way .. it encrypts by using 16 byte blocks but is much faster then md5 or sha1 .. you can use a loop to encrypt more ;>

i just ported it here to be able to create a android winamp server .. didnt implemented any full text functions.

Would you mind sending me the source code for the library? :eek:

Also, isn't it possible adding support for more than 16 characters? Cause I don't want to split everything I want to encode using this great algorithm.
 

techknight

Well-Known Member
Licensed User
Longtime User
This is great for strings. But how would I use this at a Byte level? Say my key is in binary. and my message is in binary, in 8 byte chunks.
 
Top