Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. rot(C, B, N) ->
  2. (C - B + N) rem 26 + B.
  3.  
  4. encrypt([], _) -> [];
  5. encrypt([C | S], N) ->
  6. Nc = if
  7. ($A =< C) andalso ($Z >= C) ->
  8. rot(C, $A, N);
  9. ($a =< C) andalso ($z >= C) ->
  10. rot(C, $a, N);
  11. true ->
  12. C
  13. end,
  14. [Nc | encrypt(S, N)].
  15.  
  16. decrypt(String, N) ->
  17. encrypt(String, 26-N).
  18.  
  19. test_version() -> 1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement