Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,31 @@
Module Module1
Function Encrypt(ch As Char, code As Integer) As Char
If Not Char.IsLetter(ch) Then
Return ch
End If
Dim offset = AscW(If(Char.IsUpper(ch), "A"c, "a"c))
Dim test = (AscW(ch) + code - offset) Mod 26 + offset
Return ChrW(test)
End Function
Function Encrypt(input As String, code As Integer) As String
Return New String(input.Select(Function(ch) Encrypt(ch, code)).ToArray())
End Function
Function Decrypt(input As String, code As Integer) As String
Return Encrypt(input, 26 - code)
End Function
Sub Main()
Dim str = "Pack my box with five dozen liquor jugs."
Console.WriteLine(str)
str = Encrypt(str, 5)
Console.WriteLine("Encrypted: {0}", str)
str = Decrypt(str, 5)
Console.WriteLine("Decrypted: {0}", str)
End Sub
End Module