Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1.  
  2. fun String.oneOf(l: List<String>): Boolean {
  3. for (i in l) {
  4. if (this.contains(i)) {
  5. print("\n" + i + ": --- ")
  6. return true
  7. }
  8. }
  9. return false
  10. }
  11.  
  12. fun filter(a: List<Char>) {
  13. val sb = StringBuilder()
  14. a.forEach({ sb.append(it) })
  15. val str = sb.toString()
  16. if (str.oneOf(listOf("send", "gambit", "email", "apply"))) {
  17. println(str)
  18. }
  19. }
  20.  
  21. fun main(args: Array<String>) {
  22. val inp = "166 102 39 202 112 231 126 68 42 204 104 45 191 117 48 202 98 47 199 112 41 209 33 33 205 115 219 " +
  23. "209 112 39 212 106 41 197 33 47 198 102 219 165 98 40 192 106 47 126 100 35 191 109 39 195 111 34 " +
  24. "195 47 219 174 109 32 191 116 32 126 116 32 204 101 219 215 112 48 208 33 46 205 109 48 210 106 42 " +
  25. "204 33 28 204 101 219 161 87 219 210 112 219 199 100 28 204 100 42 194 102 251 197 98 40 192 106 " +
  26. "47 208 102 46 195 98 45 193 105 233 193 112 40 126 114 48 205 117 36 204 104 219 208 102 33 195 115 " +
  27. "32 204 100 32 152 33 236 144 98 235 145 100 31 147 56 30 140"
  28. val chars = mutableListOf<Char>()
  29. inp.split(" ").forEach({ chars.add((it.toInt()).toChar()) })
  30.  
  31. var a = 0
  32. var b = 0
  33. var c = 0
  34.  
  35. for (i in 0..1.shl(24)) {
  36. a = (a + 1) % 256
  37. if (i % 256 == 0) {
  38. b = (b + 1) % 256
  39. }
  40. if (i % 1.shl(16) == 0) {
  41. c = (c + 1) % 256
  42. }
  43.  
  44. print("\r $a $b $c")
  45.  
  46. val arr = mutableListOf<Char>()
  47. chars.forEach({ arr.add(it) })
  48. for (i in 0 until chars.size) {
  49. arr[i] = ((arr[i].toInt() +
  50. when {
  51. i % 3 == 0 -> a
  52. i % 3 == 1 -> b
  53. i % 3 == 2 -> c
  54. else -> 0
  55. }) % 256).toChar()
  56. }
  57. filter(arr)
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement