1. Symmetric Encryption-Decryption

Here, a common key K is generated using the key-generation function, and using this key:

Features:

  • plainText cannot be derived from cipherText without knowing the key.
  • Fast execution (comparatively — even for large plainText).
  • Key has to be shared securely somehow (between sender and receiver), which is not a trivial problem.

2. Asymmetric Encryption-Decryption

Here, a pair of keys (publicKey + privateKey) is generated using the key-generation function, and using this pair:


You are a frontend developer, in love with your beautiful site that you created yourself and deployed to Netlify. Now you want to add a Contact Me section to it, but don’t want to deal with backend development and deployment and maintenance for it. Third-party form services could be your answer, but they are too costly for your little site which is not going to have thousands or even hundreds of form responses. Hacking a Google Sheet script is also not a solution now since we are not living in the 2010s anymore. So what do you do?

You do…


In the browser context, the document node has execCommand method, which has the following syntax:

document.execCommand(aCommandName, aShowDefaultUI, aValueArgument)

For this, simply use "Copy" in place of aCommandName in the syntax mentioned above, like this:

// myInputElement is some <input type=”text”> element// Select the value/contents of the element
myInputElement.select();
// Copy it to clipboard
document.execCommand(“Copy”);

For copying the text, you need to select it. But select doesn’t works for every HTML element. I specifically used…

Bharat Ramnani

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store