Repository navigation
Expand file tree
/
Copy pathhashes.html
More file actions
167 lines (157 loc) · 11.3 KB
/
Copy pathhashes.html
File metadata and controls
167 lines (157 loc) · 11.3 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html lang="de" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hashes & Encoding – CryptoStudio</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = { darkMode: 'class', theme: { extend: {} } }
</script>
<style>
:root { --bg:#090909; --bg-panel:#111111; --bg-soft:rgba(255,255,255,0.04); --text:#f5f5f5; --muted:#b9b9b9; --border:rgba(255,255,255,0.12); }
body.theme-light { --bg:#f5f3ef; --bg-panel:#ffffff; --bg-soft:rgba(17,17,17,0.03); --text:#111111; --muted:#4d4d4d; --border:rgba(17,17,17,0.08); }
body { background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
*::selection { background: rgba(255,255,255,0.18); color: var(--text); }
header, footer, .bg-slate-900\/60, .bg-slate-900\/40, .bg-slate-950, .bg-slate-900, .bg-slate-800 { background: var(--bg-panel) !important; border-color: var(--border) !important; }
.text-slate-300, .text-slate-400, .text-slate-500, .text-slate-200 { color: var(--muted) !important; }
.text-white, .text-slate-100 { color: var(--text) !important; }
.border-slate-800, .border-slate-700 { border-color: var(--border) !important; }
.bg-emerald-500\/10, .bg-emerald-600, .bg-emerald-600\/20, .bg-emerald-500 { background: var(--bg-soft) !important; border-color: var(--border) !important; color: var(--text) !important; }
.text-emerald-400, .text-emerald-300 { color: var(--text) !important; }
.theme-toggle { width:2.4rem; height:2.4rem; display:inline-flex; align-items:center; justify-content:center; border-radius:999px; border:1px solid var(--border); background: var(--bg-soft); color: var(--text); cursor: pointer; }
.brand-link { display:inline-flex; align-items:center; gap:0.5rem; padding:0.45rem 0.8rem; border-radius:999px; border:1px solid var(--border); background:var(--bg-soft); color:var(--text); font-size:0.72rem; letter-spacing:0.12em; text-transform:uppercase; }
.brand-mark { display:inline-flex; width:1.7rem; height:1.7rem; border-radius:999px; border:1px solid var(--border); background: var(--bg-soft); align-items:center; justify-content:center; font-size:0.7rem; font-weight:700; }
</style>
</head>
<body class="min-h-screen flex flex-col antialiased">
<div id="toast" class="fixed top-4 left-1/2 -translate-x-1/2 sm:left-auto sm:right-5 sm:translate-x-0 z-50 transform -translate-y-24 opacity-0 transition-all duration-300 pointer-events-none">
<div class="bg-slate-900/90 backdrop-blur-md text-white font-medium px-4 py-3 rounded-xl shadow-2xl flex items-center justify-center space-x-2 border border-slate-700 text-sm">
<svg class="w-5 h-5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span id="toastMsg">In die Zwischenablage kopiert!</span>
</div>
</div>
<header class="border-b border-slate-800/80 sticky top-0 z-40 backdrop-blur-md">
<div class="max-w-5xl mx-auto px-4 sm:px-6 py-4 flex items-center justify-between">
<a href="index.html" class="flex items-center space-x-3 group">
<div class="brand-mark">A</div>
<div>
<span class="font-bold text-lg tracking-tight">CryptoStudio</span>
<span class="block text-[11px] text-slate-400">Minimalist Cryptography Suite</span>
</div>
</a>
<div class="flex items-center gap-3">
<button id="themeToggle" class="theme-toggle" aria-label="Toggle theme">☼</button>
<a href="https://github.com/arien-dev" target="_blank" rel="noopener" class="brand-link"><span class="brand-mark">G</span> Made by arien-dev</a>
</div>
</div>
</header>
<main class="max-w-4xl mx-auto w-full px-4 sm:px-6 py-8 flex-grow">
<div class="mb-8 flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 border-b border-slate-800/80">
<div>
<span class="text-xs font-mono uppercase tracking-widest text-slate-300">Hashes Module</span>
<h1 class="text-2xl sm:text-3xl font-black tracking-tight mt-1">Hashes & Kodierung</h1>
<p class="text-slate-400 text-xs sm:text-sm mt-1">Berechne SHA-256, SHA-512, Base64 und Hex in Echtzeit lokal im Browser.</p>
</div>
<div class="inline-flex items-center space-x-2 bg-slate-900/60 border border-slate-800 px-3 py-1.5 rounded-full text-xs self-start md:self-auto">
<span class="w-2 h-2 rounded-full bg-white animate-pulse"></span>
<span>100% Lokale Berechnung</span>
</div>
</div>
<div class="bg-slate-900/60 border border-slate-800 rounded-2xl p-6 sm:p-8 shadow-xl backdrop-blur-md space-y-6">
<div>
<label class="block text-xs font-semibold uppercase tracking-wider text-slate-300 mb-2">Eingabetext / String</label>
<textarea id="hashInput" oninput="updateHashes()" placeholder="Gib hier einen beliebigen Text ein..." class="w-full h-28 bg-slate-950 border border-slate-800 rounded-xl p-3.5 text-sm text-slate-100 focus:border-white focus:ring-1 focus:ring-white outline-none"></textarea>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-slate-950 p-4 rounded-xl border border-slate-800 flex flex-col justify-between">
<div class="flex justify-between items-center mb-2">
<span class="text-xs font-bold text-white uppercase tracking-wider">SHA-256 Hash</span>
<button onclick="copyToClipboard(document.getElementById('hashSha256').innerText)" class="text-xs text-slate-300 hover:text-white font-medium">Kopieren</button>
</div>
<div id="hashSha256" class="font-mono text-xs text-slate-300 break-all select-all min-h-[20px]">-</div>
</div>
<div class="bg-slate-950 p-4 rounded-xl border border-slate-800 flex flex-col justify-between">
<div class="flex justify-between items-center mb-2">
<span class="text-xs font-bold text-white uppercase tracking-wider">SHA-512 Hash</span>
<button onclick="copyToClipboard(document.getElementById('hashSha512').innerText)" class="text-xs text-slate-300 hover:text-white font-medium">Kopieren</button>
</div>
<div id="hashSha512" class="font-mono text-xs text-slate-300 break-all select-all min-h-[20px]">-</div>
</div>
<div class="bg-slate-950 p-4 rounded-xl border border-slate-800 flex flex-col justify-between">
<div class="flex justify-between items-center mb-2">
<span class="text-xs font-bold text-white uppercase tracking-wider">Base64 Encoded</span>
<button onclick="copyToClipboard(document.getElementById('hashBase64').innerText)" class="text-xs text-slate-300 hover:text-white font-medium">Kopieren</button>
</div>
<div id="hashBase64" class="font-mono text-xs text-slate-300 break-all select-all min-h-[20px]">-</div>
</div>
<div class="bg-slate-950 p-4 rounded-xl border border-slate-800 flex flex-col justify-between">
<div class="flex justify-between items-center mb-2">
<span class="text-xs font-bold text-white uppercase tracking-wider">Hex Representation</span>
<button onclick="copyToClipboard(document.getElementById('hashHex').innerText)" class="text-xs text-slate-300 hover:text-white font-medium">Kopieren</button>
</div>
<div id="hashHex" class="font-mono text-xs text-slate-300 break-all select-all min-h-[20px]">-</div>
</div>
</div>
</div>
</main>
<footer class="border-t border-slate-800/80 py-6 text-center mt-auto">
<p class="text-xs text-slate-400">
© CryptoStudio – Minimalist & Secure Local Crypto Tools.
<a href="https://github.com/arien-dev" target="_blank" rel="noopener" class="underline hover:text-white ml-2">Made by arien-dev</a>
</p>
</footer>
<script>
const toggle = document.getElementById('themeToggle');
const applyTheme = (theme) => {
document.body.classList.toggle('theme-light', theme === 'light');
if (toggle) toggle.textContent = theme === 'dark' ? '☼' : '☾';
localStorage.setItem('cryptoTheme', theme);
};
applyTheme(localStorage.getItem('cryptoTheme') || 'dark');
if (toggle) toggle.addEventListener('click', () => applyTheme(document.body.classList.contains('theme-light') ? 'dark' : 'light'));
function copyToClipboard(text) {
if (!text || text === '-') return;
navigator.clipboard.writeText(text).then(() => {
showToast('In die Zwischenablage kopiert!');
}).catch(err => {
showToast('Kopieren fehlgeschlagen: ' + err);
});
}
function showToast(msg) {
const toast = document.getElementById('toast');
document.getElementById('toastMsg').innerText = msg;
toast.classList.remove('-translate-y-24', 'opacity-0');
toast.classList.add('translate-y-0', 'opacity-100');
setTimeout(() => {
toast.classList.remove('translate-y-0', 'opacity-100');
toast.classList.add('-translate-y-24', 'opacity-0');
}, 2500);
}
async function updateHashes() {
const input = document.getElementById('hashInput').value;
if (!input) {
document.getElementById('hashSha256').innerText = '-';
document.getElementById('hashSha512').innerText = '-';
document.getElementById('hashBase64').innerText = '-';
document.getElementById('hashHex').innerText = '-';
return;
}
const encoder = new TextEncoder();
const data = encoder.encode(input);
const hashBuffer256 = await window.crypto.subtle.digest('SHA-256', data);
const hashArray256 = Array.from(new Uint8Array(hashBuffer256));
document.getElementById('hashSha256').innerText = hashArray256.map(b => b.toString(16).padStart(2, '0')).join('');
const hashBuffer512 = await window.crypto.subtle.digest('SHA-512', data);
const hashArray512 = Array.from(new Uint8Array(hashBuffer512));
document.getElementById('hashSha512').innerText = hashArray512.map(b => b.toString(16).padStart(2, '0')).join('');
try {
document.getElementById('hashBase64').innerText = btoa(unescape(encodeURIComponent(input)));
} catch (e) {
document.getElementById('hashBase64').innerText = 'Fehler beim Base64 Kodieren';
}
document.getElementById('hashHex').innerText = Array.from(data).map(b => b.toString(16).padStart(2, '0')).join('');
}
</script>
</body>
</html>