05.10.2022

SJCL - Stanford Javascript Crypto Library

Die SJCL-Bibliothek sjcl.js hat ein einfach funktionierendes encrypt/decrypt-Funktionspärchen. Die komplette Bibliothek ist in einer JS-Datei enthalten.

Nutzung

const paraphrase = "Secret Passphrase";

function encrypt(cleartext) {
	var encrypted = sjcl.encrypt(paraphrase, cleartext); 
	var stringified = JSON.stringify(encrypted);
	return btoa(stringified);
}

function decrypt(keyedtext) {
	var unbased = atob(keyedtext);
	var encrypted = JSON.parse(unbased);
	return sjcl.decrypt(paraphrase, encrypted);
}

Lizenz:

SJCL is open. You can use, modify and redistribute it under a BSD license or under the GNU GPL, version 2.0 or higher.

Alternativen

Eine Alternative ist die Bibliothek aes-js.

Möglicherweise identisch ist die Bibliothek crypto-js bei Google. Zumindest die Versionsnummern 3.1.2 sind gleich.

Über … ×

doc.stumpp.name
Version 0.2.14

Michael Stumpp
michael@stumpp.name

Diese Webseite ist ein rein privates Angebot. Von dieser Seite werden keine Cookies oder andere Tracking-Methoden eingesetzt. Die Seite nutzt, soweit möglich, lokale Kopien der eingesetzen Bibliotheken und Ressourcen.

Lizenz: ISC ×
/*
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
Release Notes ×
  doc.stumpp.name
  Version 0.2.14
  Release Notes


  v0.1
    + Erstausgabe