prog

Untitled

Sep 19th, 2009
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. alias base64 {
  2. set %b64 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
  3. if (enc* iswm $prop) {
  4. var %x = $len($1-), %i = 0, %bstr = ""
  5. while (%i < %x) {
  6. inc %i 1
  7. %bstr = %bstr $+ $base($asc($mid($1-,%i,1)),10,2,8)
  8. }
  9. var %x = $len(%bstr), %i = 1, %bc = "", %p = $calc($len(%bstr) % 6), %bits = ""
  10. while (%i < %x) {
  11. %bc = $mid(%bstr,%i,6)
  12. if ($len(%bc) < 6) { %bc = %bc $+ $str(0,$calc(6 - $len(%bc))) }
  13. %bits = %bits $+ $mid(%b64,$calc($base(%bc,2,10) + 1),1)
  14. inc %i 6
  15. }
  16. if (%p > 0) {
  17. if (%p == 2) %bits = %bits $+ ==
  18. elseif (%p == 4) %bits = %bits $+ =
  19. }
  20. return %bits
  21. }
  22. elseif (dec* iswm $prop) {
  23. var %x = $len($1), %i = 0, %bstr = "", %p = $numtok($1,$asc(=)), %pos = 0, %asc = 0
  24. while (%i < %x) {
  25. inc %i 1
  26. %pos = $poscs(%b64,$mid($1,%i,1),1)
  27. if (%pos > 0) { %pos = $calc(%pos - 1) }
  28. %bstr = %bstr $+ $base(%pos,10,2,6)
  29. }
  30. var %x = $len(%bstr), %i = 1, %text = ""
  31. while (%i < %x) {
  32. %asc = $base($mid(%bstr,%i,8),2,10)
  33. if (%asc == 32) { %text = %text $chr(%asc) }
  34. else { %text = %text $+ $chr(%asc) }
  35. inc %i 8
  36. }
  37. return %text
  38. }
  39. }
  40.  
  41. alias crypt {
  42. .msg # $chr(15) $+ $base64($1-).encode
  43. echo $color(own text) -t # < $+ $iif($me isop #, @, $iif($me isvoice #, +, $null)) $+ $me $+ > $1-
  44. }
  45.  
  46. alias crypto {
  47. if ($1 == on) { .enable #crypto | echo 3 -a * Crypto is on }
  48. else if ($len($1) > 0) { .disable #crypto | echo 3 -a * Crypto is off }
  49. }
  50.  
  51. #crypto on
  52. on *:input:#: if (/* !iswm $1) { crypt $1- | halt }
  53. #crypto end
  54. on ^*:text:$($chr(15) $+ *):#: echo $color(normal text) -t # < $+ $iif($nick isop #, @, $iif($nick isvoice #, +, $null)) $+ $nick $+ > $base64($strip($1-)).decode | haltdef
  55.  
Add Comment
Please, Sign In to add comment