initial commit

This commit is contained in:
2026-07-04 18:22:23 -06:00
commit 55522fc6fc
272 changed files with 12391 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
extends Node
var computer_a = {
"crypto": Crypto.new(),
"private_key": null,
"peer_public_key": null,
}
var computer_b = {
"crypto": Crypto.new(),
"private_key": null,
"peer_public_key": null,
}
"""
"""
func _ready() -> void:
computer_a["private_key"] = computer_a["crypto"].generate_rsa(2048)
computer_b["private_key"] = computer_b["crypto"].generate_rsa(2048)
var a_pub_key: String = computer_a["private_key"].save_to_string(true)
print(len(a_pub_key))
var b_pub_key = computer_b["private_key"].save_to_string(true)
var key_a = CryptoKey.new()
key_a.load_from_string(b_pub_key, true)
var key_b = CryptoKey.new()
key_b.load_from_string(a_pub_key, true)
computer_a["peer_public_key"] = key_a
computer_b["peer_public_key"] = key_b
var encrypted: PackedByteArray = computer_a["crypto"].encrypt(computer_a["peer_public_key"], "This is a test".to_utf8_buffer())
var decrypted = computer_b["crypto"].decrypt(computer_b["private_key"], encrypted).get_string_from_utf8()
print(encrypted)
print(decrypted)
+1
View File
@@ -0,0 +1 @@
uid://cinuxr6vprqf
+6
View File
@@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://c1xdc0ckp7c1w"]
[ext_resource type="Script" uid="uid://cinuxr6vprqf" path="res://cryptography/test.gd" id="1_8fnwx"]
[node name="Test" type="Node2D" unique_id=2147367880]
script = ExtResource("1_8fnwx")