anchor.diff:  -module(mochiweb_session).
   -export([generate_session_data/5,generate_session_cookie/5,check_session_cookie/4]).
   -export([cookie_encode/1,cookie_decode/1]).
  -
   
   %% @spec generate_session_data(UserName,ExpirationTime,SessionExtraData : iolist(),FSessionKey : function(A),ServerKey) -> string()
   %% @doc generates a secure encrypted string convining all the parameters.
  
positive.code: 	    end
      end;
  check_session_cookie(A,_,_,_,_) ->
      io:format("what the hell ~p~n",[A]),
      {false,[]}.
  
  %% @doc This does not encrypt the whole cookie
  cookie_decode (Encoded) ->
      erlang:binary_to_term (hexstr_to_bin(Encoded)).
  cookie_encode (Term) ->
      bin_to_hexstr(erlang:term_to_binary (Term, [compressed,{minor_version,1}])).
  
  %% cookie_encrypt_data(Data,Key)-> binary()
  %%                                Data = Key = iolist() | binary
  
negative.code:     {false,[]};
  check_session_cookie([],_,_,_) ->
      {false,[]};
  check_session_cookie(Cookie,ExpirationTime,FSessionKey,ServerKey) when is_integer(ExpirationTime), is_list(Cookie), is_list(ServerKey)->
      check_session_cookie(string:tokens(binary_to_list(cookie_decode(Cookie)), ","),Cookie,ExpirationTime,FSessionKey,ServerKey).
  check_session_cookie([UserName, ExpirationTime1, EData, Hmac],Cookie,ExpirationTime,FSessionKey,ServerKey) 
    when is_integer(ExpirationTime) , is_list(Cookie), is_list(ServerKey)->
      ExpTime=list_to_integer(ExpirationTime1),
      Key=cookie_gen_key(UserName,ExpirationTime1,ServerKey),
      Data=cookie_decrypt_data(EData,Key),
  