Shrimp's Crypto Helper

Shrimp

Well-known Member
Mar 28, 2022
11
0
41
Hello, I made a crypto helper that can be used in place of getchar and cshift. Enjoy:

Functions you can use:
  • cshift(string input,number offset)
  • Just like regular cshift, first parameter is your string you want to shift, second parameter is your offset amount. Returns decoded string;
  • getchar(string input)
  • Also just like regular getchar, automatically separates the commas for you so you can directly input the whole string. Returns decoded string.
NOTE: Both functions will return "" if any inputs are NULL.


How to install/use:
  1. Copy compiled version or compile source code into an .mscx file named whatever you want for the purpose of simplicity our .mscx file is going to be called crypto.mscx.
  2. In your file that you want to use add the following code:
include "pathTo/crypto.mscx"; CryptoHelper crypto = new CryptoHelper();

  • To use a function like getchar do string newString = crypto.getchar(input);

This is my first time making something like this for other people to use so if you have any suggestions on how to improve it or any questions you can lemme know on here or dm me on discord (xtrashrimpyguy). Hope this helps!

Update 8/25/2023: Fixed an oversight on my part where it would leave out numbers, in the real cshift it just leaves the numbers as is so that's what I had it do here. Also added a VERY simple function where it just detects whether a character is a number. Added the documentation for that here if you feel the need to use it lmao.

Update 9/23/2023: Class is much faster using the Bit library and String additions. I got rid of some old functions like IsUpper and IsNumber because they're not that useful when you directly get the ASCII value and getting the ASCII value is much faster. I also added a constructor and reduced the source code to around 44 lines. Any existing programs you have using this library will still work and be faster using this new code, and as usual if you have any question feel free to DM on discord or something. Thanks!

Source Code:
using System; using Console; using String; using Array; using Util; using Bit; class CryptoHelper { constructor(){ Console.WriteLine("[CRYPTO_HELPER]: Shrimp's CryptoHelper loaded!"); } function<string> cshift(string phrase,number offset){ if(Util.IsNull(phrase) || Util.IsNull(offset)){ return ""; } number length = String.Length(phrase); number[] phraseBytes = String.Bytes(phrase,1,length); number[] offsetBytes = new number[length]; number i = 1; while(i <= length){ number byte = phraseBytes[i]; if(byte >= 65 && byte <= 90){ offsetBytes[i] = 65 + ((byte - 65 + offset) % 26); } else if(byte >= 97 && byte <= 122){ offsetBytes[i] = 97 + ((byte - 97 + offset) % 26); } else{ offsetBytes[i] = phraseBytes[i]; } i = i + 1; } return String.Chars(offsetBytes); } function<string> getchar(string input){ if(Util.IsNull(input)){return "";} string[] split_input = String.Split(input,","); number length = Array.Length(split_input); number[] bytes = new number[length]; number j = 1; while(j <= length){ bytes[j] = Util.ToNumber(split_input[j]); j = j + 1; } return String.Chars(bytes); } }


Compiled code:
24 {"compiler_version":2.0} 8m40fBteWFyZVoxT1OfGHoTRA7JBoZYHxLFKJE7eN/pWxjjMsX6dLf3HALArJmwo tOAhCd8yRqyZfxIrPtSZYdGtBxun3ss82dXjxdRhziedKKMw87NcE2FGw0IqL7P8 u0qdWF224bg+9fZLqsOrWjkkAl90Rf1R5CZDUAv7q2mzvMbgYUUtIVH7ezauz0N/ KBvw4jkOvyrDO9jYfQjEKxqMmIX9Nn1tdhqs3Jyi1UQbCAzsGc+k9uwTdnMcBb2+ 1Hwwl4n7QusA5vYywJRPnc+AMenysEbcTO7R+q13cv3NcYk5NgHkaWGuCJgvwMtF KmZXa4r0tlvCSe2nKFBuQgj2rTq040EbTa3nVIaa7l+bh1zZ+V3+NEOkgC715QVX 1STKJK0zrwBmfeqHBDrT7K9ULsKLdjcEyqvRj1uyPIgadt6AWYRTSml2Jn8axzpL /PwibkZXaM9LMbwaVmjVe2M9oYsMyji78X2kp9FsNEb05yAtQly8ouEtGUne4dQE rL8jymyYNDiVNCkAXA4EIo0Ont9IoWW9TUJQtPI79Y5EqwLJwLKlBLR4vBo+hX1O t7MbPejq5BwfWFccblufZ8FIAPS0k84tEc/0kizw8lTTqTtXeyI+BtLntD+M5X40 JxBoRpE813a31qX9sewGz+QFvCYSHiWqTv643o2+PmcHBYWNJ4mSQ/4/Om/2IArC /A7aIW+yOW5Xg63sstQUedsLSZA2RxdxnRScyHzQTN/1MVeTK1jvm7X8lwNNcpkp wJTXmzaewp7H7ortpeBSoDCg2IskLb3RAHANiLor6E9NzL7nRfVYRavwSGT145XZ Ce/PyEGtcErt93T/hkYvsGjgZ4QhPSEJt2cCwTAjc+FkBr6RcQYt3N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