Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- public string TextToEncrypt;
- public int gridSize = 4;
- public int buttonSize = 40;
- float Squareroot;
- void Encrypt (string textToEncrypt)
- {
- string tempInput = textToEncrypt.Replace (" ", "-") + textToEncrypt.Replace (" ", "-");
- Squareroot = Mathf.Sqrt (textToEncrypt.Length);
- gridSize = Mathf.CeilToInt (Squareroot);
- int numberToAdd = gridSize * gridSize - textToEncrypt.Length;
- string encryptedtxt = "";
- for (int i =0; i<Squareroot; i++) {
- for (int j=0; j<(int)Squareroot*(int)Squareroot; j+=(int)Squareroot) {
- encryptedtxt += tempInput.Substring (j + i, 1);
- }
- }
- textToEncrypt= encryptedtxt;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement