Erlang/OTP Forums

Author Message

<  Erlang  ~  xtea cryptography using erlang

jp
Posted: Tue Oct 02, 2007 12:37 am Reply with quote
Joined: 02 Oct 2007 Posts: 1
Hello everyone, I have a good background in imperative/procedural and OO programming language but absolutely no experience in functional languages.

For fun, I gave myself the assignement to implement the xtea cipher (http://en.wikipedia.org/wiki/XTEA).

I have identified the functions that I will need in erlang: bsr, bsl, math:pow , etc.

My main problem is that I do not know how to implement it because variables can only be assigned once in erlang.

Is there a way to dynamically generate variables ?

I am looking for basic guidelines/tips as I want to implement it by myself.

Thanks,
jp
View user's profile Send private message
francesco
Posted: Mon Oct 15, 2007 3:34 pm Reply with quote
User Joined: 07 Jul 2006 Posts: 249 Location: London
Hi JP,

the way to tackle single assignment of variables in Erlang is to use recursion. Whenever you call a function recursively, all variables in the function body are considered "fresh".

Francesco
--
http://www.erlang-consulting.com
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum