Update encode.js

avoiding crypto dep.