title: JavaScript to Python (Using JS2PY)
body: <p>I have a seed-calculating thing that uses JavaScript (Functions properly). I'm attempting to convert it into Python (For a more detailed project) using the JS2PY library.</p>
  <p>My code:</p>
  <pre><code>import js2py
  
  hasCode = js2py.eval_js('function hashCode(s) {let h = 0; for (let i = 0; i &lt; s.length; i++) {h = (Math.imul(31, h) + s.charCodeAt(i)) | 0;} return h;}')
  getSeed = js2py.eval_js('function getSeed(s) {let x = BigInt(hashCode(s)); if (/^[\-\+0-9]*$/.test(s)) {try {let y = BigInt(s); if (BigInt.asIntN(64, y) !== y) {throw RangeError();} x = y;} catch (err) {}} return { high: x &gt;&gt; 32n, low: BigInt.asIntN(32, x) };}')
  output = js2py.eval_js('function output() {let seed = -734744700160476640; print(&quot;Copy this output - &quot; + seed.high, seed.low);}')
  
  output()
  </code></pre>
  <p>Should you use this in, say, a HTML file, the JavaScript will produce a &quot;High&quot; and &quot;Low&quot; of the seed input (Here it is -734744700160476640, but I would allow users to input their own seed).</p>
  <p>The command log explains that there's syntax errors in files that I'm assuming is from the library. You can probably tell I'm a little inexperienced so if it's my own code that's broken, shout it out. I don't know if JS2PY is outdated or if there's better options out there. I couldn't find any myself.</p>