<commit_before>(ns great-things-done.crypto
  "Encryption/Decryption node modulde based on https://gist.github.com/chris-rock/993d8a22c7138d1f0d2e#file-crypto-ctr-js")

(def ^:private crypto (js/require "crypto"))

;; function encrypt(text){
;;   var cipher = crypto.createCipher(algorithm,password)
;;   var crypted = cipher.update(text,'utf8','hex')
;;   crypted += cipher.final('hex');
;;   return crypted;
;; }

(defn encrypt
  "Encrypt the provided text with the provided password. An optional algorithm can be provided, default is `aes-256-ctr`"
  [text password & {:keys [algorithm]
                    :or {algorithm "aes-256-ctr"}}]
  (let [cipher  (.createCipher crypto algorithm password)
        crypted (.update cipher text "utf8" "hex")]
    (+ crypted (.final cipher "hex"))))

;; function decrypt(text){
;;   var decipher = crypto.createDecipher(algorithm,password)
;;   var dec = decipher.update(text,'hex','utf8')
;;   dec += decipher.final('utf8');
;;   return dec;
;; }

(defn decrypt
  "Decrypt the provided text with the provided password. An optional algorithm can be provided, default is `aes-256-ctr`"
  [text password & {:keys [algorithm]
                    :or {algorithm "aes-256-ctr"}}]
  (let [decipher  (.createDecipher crypto algorithm password)
        decrypted (.update decipher text "hex" "utf8")]
    (+ decrypted (.final decipher "utf8"))))<commit_msg>Fixes crypto<commit_after>(ns great-things-done.crypto
  "Encryption/Decryption node modulde based on https://gist.github.com/chris-rock/993d8a22c7138d1f0d2e#file-crypto-ctr-js")

(def ^:private remote (js/require "remote"))
(def ^:private crypto (.require remote "crypto"))

;; function encrypt(text){
;;   var cipher = crypto.createCipher(algorithm,password)
;;   var crypted = cipher.update(text,'utf8','hex')
;;   crypted += cipher.final('hex');
;;   return crypted;
;; }

(defn encrypt
  "Encrypt the provided text with the provided password. An optional algorithm can be provided, default is `aes-256-ctr`"
  [text password & {:keys [algorithm]
                    :or {algorithm "aes-256-ctr"}}]
  (let [cipher  (.createCipher crypto algorithm password)
        crypted (.update cipher (str text) "utf8" "hex")]
    (+ crypted (.final cipher "hex"))))

;; function decrypt(text){
;;   var decipher = crypto.createDecipher(algorithm,password)
;;   var dec = decipher.update(text,'hex','utf8')
;;   dec += decipher.final('utf8');
;;   return dec;
;; }

(defn decrypt
  "Decrypt the provided text with the provided password. An optional algorithm can be provided, default is `aes-256-ctr`"
  [text password & {:keys [algorithm]
                    :or {algorithm "aes-256-ctr"}}]
  (let [decipher  (.createDecipher crypto algorithm password)
        decrypted (.update decipher (str text) "hex" "utf8")]
    (+ decrypted (.final decipher "utf8"))))
{'fraction_non_alphanumeric': 0.1494899753781217, 'fraction_numerical': 0.021807949349278932, 'mean_word_length': 3.946086956521739, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3847882', 'n_tokens_mistral': 947, 'n_tokens_neox': 881, 'n_words': 250}