Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. {
  2. public string TextToEncrypt;
  3. public int gridSize = 4;
  4. public int buttonSize = 40;
  5. float Squareroot;
  6.  
  7. void Encrypt (string textToEncrypt)
  8. {
  9. string tempInput = textToEncrypt.Replace (" ", "-") + textToEncrypt.Replace (" ", "-");
  10.  
  11. Squareroot = Mathf.Sqrt (textToEncrypt.Length);
  12. gridSize = Mathf.CeilToInt (Squareroot);
  13. int numberToAdd = gridSize * gridSize - textToEncrypt.Length;
  14.  
  15. string encryptedtxt = "";
  16. for (int i =0; i<Squareroot; i++) {
  17. for (int j=0; j<(int)Squareroot*(int)Squareroot; j+=(int)Squareroot) {
  18. encryptedtxt += tempInput.Substring (j + i, 1);
  19. }
  20. }
  21. textToEncrypt= encryptedtxt;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement