sam
sam

Reputation: 1

Is it possible to encrypt the password in JavaScript?

I am password protecting the xl file while opening. The code is like:

myobjExcel.Worksheets(i).Protect("password");

So this password can be seen by clicking on View -> Source

So how can I encrypt this?

Upvotes: 0

Views: 150

Answers (1)

Joey
Joey

Reputation: 354576

You can only obfuscate it. But actual encryption so that someone looking at it can't figure it out (or needs a few billion years to do so) is impossible as that only works with a secret. And the only place where you could supply such a secret would be the source code itself.

And handing someone a ciphertext and the secret to decrypt it is equivalent to giving him the plain text.

The only thing you can do here is make it harder for someone to see it, but it someone is determined to get the password, then they will.

Upvotes: 3

Related Questions