You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing PythonMonkey with the CryptoJS NPM package and noticed calling toString() on the objects returned from it would yield empty strings. Refer to this example to reproduce it:
In Python:
(Pdb) CryptoJS.SHA256("hello").toString()
''
^ when ran in Python, it just returns an empty string
It prints the empty string, but it should print dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
If I call toString() in JavaScript code and call that JavaScript code from Python it works as expected. So for examples like this I do something like this:
Activity
wesgarland commentedon Jul 14, 2023
@wiwichips Would you might retesting against today's tip?
wiwichips commentedon Jul 19, 2023
For what its worth I am still seeing this behaviour on newest PythonMonkey pull on main:
package.json
{ "dependencies": { "crypto-js": "^4.1.1" } }main.py
It prints the empty string, but it should print
dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986fIf I call
toString()in JavaScript code and call that JavaScript code from Python it works as expected. So for examples like this I do something like this:sha256.js
main.py
philippedistributive commentedon Jan 29, 2024
Repro should be
$ npm install crypto-js
$ touch main.js
main.js:
import pythonmonkey as pm
CryptoJS = pm.require('crypto-js')
cipher = CryptoJS.SHA256("Hello, World!").toString()
print(cipher) # ''
added test for issue #58
added test for issue #58