Skip to content

Instantly share code, notes, and snippets.

View kirkchen's full-sized avatar

Kirk Chen kirkchen

View GitHub Profile
@kirkchen
kirkchen / popclip-chatgpt.js
Last active March 26, 2023 10:04 — forked from alanzchen/popclip-chatgpt.js
PopClip Actions using ChatGPT.
// #popclip extension for ChatGPT
// name: ChatGPT Quick Actions
// icon: iconify:logos:openai-icon
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: apikey, label: API Key, type: string,
// description: 'Obtain API key from https://platform.openai.com/account/api-keys'
// }]
public static string Encrypt(string source, string key)
{
Encoding encoding = new UTF8Encoding();
byte[] encodeKey = encoding.GetBytes(key);
byte[] encodeSource = encoding.GetBytes(source);
using (HMACSHA512 sha512 = new HMACSHA512(encodeKey))
{
byte[] encryptSource = sha512.ComputeHash(encodeSource);