import { useState } from 'react'; import axios from '../services/api'; function HashVerifierTool() { const [text, setText] = useState(''); const [hash, setHash] = useState(''); const [algo, setAlgo] = useState('sha256'); const [result, setResult] = useState(null); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const verify = async () => { setError(''); setResult(null); if (!text || !hash) { setError('Bitte Text und Hash eingeben.'); return; } setLoading(true); try { const res = await axios.post('/api/hash/verify', { text, hash, algorithm: algo }); setResult(res.data.match); } catch (err) { setError(err.response?.data?.message || 'Fehler bei der Verifikation'); } finally { setLoading(false); } }; return (
Prüft, ob ein Text mit einem gegebenen Hash übereinstimmt.
{ setText(e.target.value); setResult(null); setError(''); }} placeholder="Originaltext" /> { setHash(e.target.value); setResult(null); setError(''); }} placeholder="Hash-Wert" style={{ marginTop: '8px', fontFamily: 'monospace' }} /> {error &&{error}
} {result !== null && (