porting kcrypt-0.2