anchor.diff:  -define(TIMEOUT, 30000).
   
   -define(EAP_APPLICATION_ID, 5).
  --define(TEMP_TAG, $t).
  --define(FAST_TAG, $f).
  +
  +%% 3GPP TS 23.003 14.5 Temporary identities
  +-define(TEMP_TAG, 54).
  +-define(FAST_TAG, 56).
   
   %%----------------------------------------------------------------------
   %%  The ocs_eap_aka_fsm API
  
positive.code: 
  -spec compressed_imsi(IMSI) -> IMSI
  	when
  		IMSI :: string() | binary().
  %% @doc Compress or decompress an IMSI.
  %%
  %% See 3GPP 33.402 14.1 Temporary identity generation.
  %% @private
  compressed_imsi(<<15:4, _:124/bits>> = IMSI) ->
  	B = << <<A, B>> || <<A:4, B:4>> <= IMSI >>,
  	lists:flatten([integer_to_list(C) || <<C>> <= B, C /= 15]);
  compressed_imsi(IMSI) when is_binary(IMSI) ->
  	L1 = [list_to_integer([C]) || <<C>> <- IMSI],
  	L2 = lists:duplicate(16 - length(L1), 15),
  	L3 = L2 ++ L1,
  	<< <<D:4>> || D <- L3 >>.
  
negative.code: 		N :: pos_integer(),
  		Kpseu :: binary(),
  		Pseudonym :: binary().
  %% @doc Create an encrypted temporary identity.
  %%
  %% See 3GPP 33.402 14.1 Temporary identity generation.
  %% @private
  encrypt_imsi(CompressedIMSI, {N, Kpseu} = _Key)
  		when size(CompressedIMSI) == 8, size(Kpseu) == 16 ->
  	Pad = crypto:strong_rand_bytes(8),
  	PaddedIMSI = <<CompressedIMSI/binary, Pad/binary>>,
  	EncryptedIMSI = crypto:block_encrypt(aes_ecb, Kpseu, PaddedIMSI),
  	TaggedIMSI = <<?TEMP_TAG:6, N:4, EncryptedIMSI/binary, 0:6>>,
  	binary:part(base64:encode(TaggedIMSI), 0, 23).
  
  -spec decrypt_imsi(Pseudonym, Keys) -> CompressedIMSI
  	when
  		Pseudonym :: binary(),
  		Keys :: [Key],
  		Key :: {N, Kpseu},
  		N :: pos_integer(),
  		Kpseu :: binary(),
  		CompressedIMSI :: binary().
  %% @doc Decrypt a temporary identity.
  %%
  %% See 3GPP 33.402 14.1 Temporary identity generation.
  %% @private
  decrypt_imsi(Pseudonym, Keys)
  		when size(Pseudonym) == 23, is_list(Keys) ->
  	TaggedIMSI = base64:decode(<<Pseudonym/binary, $A>>),
  	<<?TEMP_TAG:6, N:4, EncryptedIMSI:16/binary, _:6>> = TaggedIMSI,
  	{_, Kpseu} = lists:keyfind(N, 1, Keys),
  	PaddedIMSI = crypto:block_decrypt(aes_ecb, Kpseu, EncryptedIMSI),
  	binary:part(PaddedIMSI, 0, 8).
  
  