(your md5 is not 32 bits long but 128 (32 hex characters * 4bits/char) but it's not plain relevant... sorry)
The pin will not hold the 128 bits information the hash contains, so you have to take a subpart of it.
I'll assume your hash is a standard java String.
if you need the pin as a 6 digits int :
int pin = hash.hashCode() % 1e6;
I let you check if this method comply with your "security" exigences :) hope it helps!