Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main()
- {
- var cipherBuffer = "";
- sbyte i;
- Console.Write("YOUR ID :");
- var buffer = Console.ReadLine();
- Debug.Assert(buffer != null, "buffer != null");
- for (i = 0; i < buffer.Length; i++)
- {
- cipherBuffer = StringFunctions.ChangeCharacter(cipherBuffer, i, (char)((buffer[i] + 1 & 0x1337)));
- }
- Console.Write("Your Key : " + cipherBuffer);
- Console.ReadLine();
- }
- }
- internal static class DefineConstants
- {
- public const int BuffSize = 20;
- }
- internal static class StringFunctions
- {
- internal static string ChangeCharacter(string sourcestring, int charindex, char changechar)
- {
- return (charindex > 0 ? sourcestring.Substring(0, charindex) : "")
- + changechar +
- (charindex < sourcestring.Length - 1 ? sourcestring.Substring(charindex + 1) : "");
- }
- internal static bool IsXDigit(char character)
- {
- if (char.IsDigit(character))
- return true;
- return "ABCDEFabcdef".IndexOf(character) > -1;
- }
- internal static string StrChr(string stringtosearch, char chartofind)
- {
- var index = stringtosearch.IndexOf(chartofind);
- return index > -1 ? stringtosearch.Substring(index) : null;
- }
- internal static string StrRChr(string stringtosearch, char chartofind)
- {
- var index = stringtosearch.LastIndexOf(chartofind);
- return index > -1 ? stringtosearch.Substring(index) : null;
- }
- internal static string StrStr(string stringtosearch, string stringtofind)
- {
- var index = stringtosearch.IndexOf(stringtofind, StringComparison.Ordinal);
- return index > -1 ? stringtosearch.Substring(index) : null;
- }
- private static string _activestring;
- private static int _activeposition;
- internal static string StrTok(string stringtotokenize, string delimiters)
- {
- if (stringtotokenize != null)
- {
- _activestring = stringtotokenize;
- _activeposition = -1;
- }
- if (_activestring == null)
- return null;
- if (_activeposition == _activestring.Length)
- return null;
- _activeposition++;
- while (_activeposition < _activestring.Length && delimiters.IndexOf(_activestring[_activeposition]) > -1)
- {
- _activeposition++;
- }
- if (_activeposition == _activestring.Length)
- return null;
- int startingposition = _activeposition;
- do
- {
- _activeposition++;
- } while (_activeposition < _activestring.Length && delimiters.IndexOf(_activestring[_activeposition]) == -1);
- return _activestring.Substring(startingposition, _activeposition - startingposition);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment