implementation of Blom's scheme