Align code with JSBN