use CryptoData::random instead of calling rng.gen
some other cleanup
more cleanup
use slice's to_vec() instead of vec's push_all()
HashMap's find() was renamed to get()