-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_encrypt.py
More file actions
94 lines (71 loc) · 2.46 KB
/
quick_encrypt.py
File metadata and controls
94 lines (71 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python3
"""Quick encryption example - encrypt data quickly"""
from payload_encrypter import encrypt_bubble_payload
import json
def quick_encrypt():
"""Quick encryption with minimal input"""
print("=" * 80)
print("⚡ Quick Encrypt - Bubble.io Payload")
print("=" * 80)
# Example 1: Encrypt simple text
print("\n📝 Example 1: Encrypting simple text")
print("-" * 80)
appname = "your_app_name"
text_data = "This is my secret message!"
result = encrypt_bubble_payload(appname, text_data)
print(f"AppName: {appname}")
print(f"Text: {text_data}")
print(f"\n✅ Encrypted x: {result['x']}")
print(f"✅ Encrypted y: {result['y']}")
print(f"✅ Encrypted z: {result['z'][:60]}...")
# Example 2: Encrypt JSON
print("\n\n📊 Example 2: Encrypting JSON data")
print("-" * 80)
json_data = {
"appname": "your_app_name",
"app_version": "live",
"user_id": "12345",
"action": "search",
"query": "active services"
}
result2 = encrypt_bubble_payload(appname, json_data)
print(f"JSON: {json.dumps(json_data, indent=2)}")
print(f"\n✅ Encrypted x: {result2['x']}")
print(f"✅ Encrypted y: {result2['y']}")
print(f"✅ Encrypted z: {result2['z'][:60]}...")
# Example 3: Save to file
print("\n\n💾 Example 3: Saving encrypted data to file")
print("-" * 80)
output_data = {
"appname": appname,
"timestamp": result2['timestamp'],
"iv_hex": result2['iv'],
"encrypted": {
"x": result2['x'],
"y": result2['y'],
"z": result2['z']
},
"original_data": json_data
}
filename = "quick_encrypted.json"
with open(filename, 'w', encoding='utf-8') as f:
json.dump(output_data, f, ensure_ascii=False, indent=2)
print(f"✅ Data saved to: {filename}")
print("\n" + "=" * 80)
print("✨ Encryption completed successfully!")
print("=" * 80)
# Show usage example
print("\n📌 To decrypt this data, use:")
print("-" * 80)
print(f'''
from payload_decrypter import decrypt_bubble_payload
timestamp, iv, payload = decrypt_bubble_payload(
appname="{appname}",
x_encrypted="{result2['x']}",
y_encrypted="{result2['y']}",
z_encrypted="{result2['z'][:40]}..."
)
print(payload.decode('utf-8'))
''')
if __name__ == "__main__":
quick_encrypt()