Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function AsciiSwitch(InputString As String, ValueToAdd As Integer) As String
- Dim OutputString As String = String.Empty
- Dim c As Char
- For i = 0 To Len(InputString) - 1
- c = InputString.Substring(i, 1)
- OutputString += Chr(Asc(c) + ValueToAdd)
- Next
- Return OutputString
- End Function
- 'Calling the function
- 'lblDecrypted.Text = AsciiSwitchBack(lblEncrypted.Text, 19)
- 'lblDecrypted.Text = AsciiSwitch(lblEncrypted.Text, -19)
- 'AsciiSwitchMod
- Function AsciiSwitchWithMod(InputString As String, ValueToAdd As Integer, ModValue As Integer) As String
- Dim OutputString As String = String.Empty
- Dim c As Char
- For i = 0 To Len(InputString) - 1
- c = InputString.Substring(i, 1)
- If i Mod 5 = 0 Then
- OutputString += Chr(Asc(c) + ValueToAdd + ModValue)
- Else
- OutputString += Chr(Asc(c) + ValueToAdd)
- End If
- Next
- Return OutputString
- End Function
- ' Calling the function
- lblEncrypted.Text = AsciiSwitchWithMod(txtInput.Text, 19, 7)
- lblDecrypted.Text = AsciiSwitchWithMod(lblEncrypted.Text, -19, -7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement