I want to do something really basic but I need to be sure that the process is safe :
Problem
Alice and Bob have to agree on a secret 6 digits PIN. They each have a preshared aes symetric key k and a AES128 block cipher. The PIN will then be used only once secretly.
I want to take care of ManintheMiddle.
Solution
 Alice creates à 128 bits random number :
Arand
 She encrypts
Arand
with basic ECB(Arand
, k) and getsAcipher
 Again, She encrypts
Acipher
with ECB(Acipher
, k), as a MAC, and getsAmac
 Alice sends to Bob
AcipherAmac
Bob does the same and sends BcipherBmac
to Alice

The two of them verify the Mac by encrypting
[AB]cipher
and comparing it to[AB]mac
. 
If the mac is ok, they uncipher
[AB]cipher
and get the[AB]rand
of the other. 
They compute the 6 digits PIN by taking 3 digits in Arand and 3 in Brand.
Question
Is it safe to use ECB mode in this particular case ? Is it safe to use the same key for encryption and for the mac in this case ? Is there a much easier solution to only agree on 6 digits ?
my answer is : as we use fixed size onebloc long messages, it’s ok am i right ?
I know we should’nt imagine ourself our own algorithms but this one seems really trivial.
Thanks ! Louis