lilwiccaseba
New member
- Joined
- Feb 6, 2009
- Messages
- 2
- Programming Experience
- Beginner
Hey ,
I'm using some functions which can be compared to encoding/decoding, but it's a really simple and basic application, not really an encoding function.
The problem is, the decoding function doesn't seem to work. For some reason, it doesn't work correctly, and I'm a bit stressed, so even after searching for a while, I can't seem to find it.
Would be cool if any of you could help me out. Thx.
Function Syntax used:
( 'Encrypted' word is sebastien )
Decoding Function:
And the encoding function:
I know it's REALLY basic, and I'm sure it's just a stupid mistake. But I'm a bit tired to be honest.. Having a hard time the last couple of days, so ^^
Thx to anyone trying to help me
I'm using some functions which can be compared to encoding/decoding, but it's a really simple and basic application, not really an encoding function.
The problem is, the decoding function doesn't seem to work. For some reason, it doesn't work correctly, and I'm a bit stressed, so even after searching for a while, I can't seem to find it.
Would be cool if any of you could help me out. Thx.
Function Syntax used:
( 'Encrypted' word is sebastien )
VB.NET:
MsgBox(TwiDec("115101987971151167105101110", 3, "332233333"))
Decoding Function:
VB.NET:
Public Function TwiDec(ByVal phrase As String, ByVal numRem As Integer, ByVal encLength As String)
Dim decoded As String = ""
Dim curNum As Integer = 0
Dim curChar As String = ""
Dim intChar As Integer = 0
For i As Integer = 0 To phrase.Length - 1
While curChar.Length.ToString <> encLength(intChar)
If curNum <> numRem Then
curChar = curChar & phrase(i)
i = i + 1
Else
curNum = 0
i = i + 1
End If
End While
curNum = curNum + 1
intChar = intChar + 1
decoded = decoded & Chr(curChar)
'Chr(curChar)
curChar = ""
Next i
Return decoded
End Function
And the encoding function:
VB.NET:
Public Function TwiEnc(ByVal phrase As String, ByVal numRem As Integer)
Dim encoded As String = ""
Dim encLength As String = ""
Dim curNum As Integer = 0
For i As Integer = 0 To phrase.Length - 1
If curNum <> numRem Then
encoded = encoded & Asc(phrase(i))
encLength = encLength & Asc(phrase(i)).ToString.Length
Else
encoded = encoded & RandomNumber(10, 0) & Asc(phrase(i))
encLength = encLength & Asc(phrase(i)).ToString.Length
curNum = 0
End If
curNum = curNum + 1 ' Increasing current number (for rem func)
Next i
Return encoded & "|" & encLength
End Function
I know it's REALLY basic, and I'm sure it's just a stupid mistake. But I'm a bit tired to be honest.. Having a hard time the last couple of days, so ^^
Thx to anyone trying to help me