php password_hash equivalent in livecode - livecode

In php, we have a password_hash function to create a password hash. Do we have an equivalent for this function in livecode?
Password has function here

According to http://php.net/manual/en/function.password-hash.php PHP's password_hash function uses bcrypt as the underlying algorithm.
I don't think LiveCode has bcrypt support natively, so you may need to install an external into your stack or call out to the command line using the shell function to get a decent hash.

Related

SPXPlatPluginsSuite->GetPluginXplatFileSpec returns XPlatFileSpec with mFileReference==0x00

I am in the process of porting a legacy (CS5) Photoshop plugin for macOS written in C++ to current technology (Photoshop 2022, macOS 12.4).
I’m currently struggling with the fact that CFURLCreateFromFSRef is deprecated and should not be used any longer. Now, thanks to the newest version of the Plugins Suite, that shouldn’t be a problem, SPXPlatPluginsSuite should return an XPlatFileSpec, which gives the file location as a CFURLRef.
Unfortunately, if I acquire the suite with kSPPluginsSuite and kSPPluginsSuiteVersion6, then call GetPluginXplatFileSpec, the resulting XPlatFileSpec.mFileReference is null, the mFileSpecVersion is 0.
If I use kSPPluginsSuiteVersion4 for the Suite acquisition, then call GetPluginFileSpecification, the resulting SPPlatformFileSpecification.mReference contains the correct (but useless) FSRef.
What am I doing wrong here?
Found a way to do it:
Stick with kSPPluginsSuiteVersion4 and GetPluginFileSpecification, then use PSGetPathSuite1 to get the path out of the returned SPPlatformFileSpecification as a string. From there I can create the URL as needed.

How to use deprecated functions in boring SSL?

I would like to convert AES128 encrypted text into base64 encoding using boringssl in android. I am using functions like "BIO_new(BIO_f_base64());" to accomplish this. The compile process fails saying undefined reference to 'BIO_f_base64()'.
On further debugging I found out that while this works with openssl it wont work with boringssl since the function is deprecated.
Below is a piece of code showing base64 encoding (this works perfectly fine with openssl):
BIO *bio, *b64;
BUF_MEM *bufferPtr;
b64 = BIO_new(BIO_f_base64());
bio = BIO_new(BIO_s_mem());
bio = BIO_push(b64, bio);
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
BIO_write(bio, buffer, length);
BIO_flush(bio);
BIO_get_mem_ptr(bio, &bufferPtr);
BIO_set_close(bio, BIO_NOCLOSE);
BIO_free_all(bio);
*b64text=(*bufferPtr).data;
return (0); //success
BoringSSl contains a seperate directory for deprecated functions wherein 'BIO_f_base64()' is defined. How may I use this ?
For me it was enough to include src/decrepit/bio/base64_bio.c in the build.
Note: I won't vouch for the security of using anything other than the default BoringSSL build :)

Node.js REPL function docstring

Theseday, I start the node.js. I have a problem in nodejs REPL.
When I use Python, I just use "?" method to check the function's docstring ( in python repl, ipython too)
That's cos function structure in ipython by using "math.cos?" order.
Otherwise, I can't find a this method in node.js repl. This function is very necessary when we do programming.
Can you give me a some tip for checking docstring in node.js ?
I afraid there is no build in command to check the function’s structure or docstring in node-repl right now as you can do in python-repl or ipython. But the good new is the contributors are already working on a feature like this.
For the time being you can use node-help or node-repl as an alternative. Although they are not good enough, they should work for now.

crypto.createECDH is not getting added with webpack

I want to use createECDH function provided by crypto module in nodejs. I downloaded all the dependencies. Webpack does not add createECDH function in my resultant javascript files. How to use createECDH function of crypto available in node.
it adds number of functions like createCipher, createDechiper, createDiffihelman, listCiphers, getCiphers etc.
Possibly you're using old version of crypto lib. According to docs, ECDH class was added in v0.11.14, later than the rest of functions you mentioned.
It would be nice to see your code.

add a builtin function to nodejs

I would like to add a couple of functions that we use extensively to nodejs in such a way that they are always available, in the same way as the builtin functions, like Date, Array, Object etcetera.
So without having to do a 'require'.
Is this possible?
gr,
Coen.
You could hack at the v8 source code that node.js is based on.

Resources