Portál AbcLinuxu, 5. května 2025 10:34
Evidentně čím více řádků, tím větší šance, že to tam bude, a tím větší tabulka. Čím více sloupců, tím větší šance, že to tam bude, a tím déle to trvá. Jaké je procento pokrytí možných hesel viz odkazovaný článek.
Má to pár háčků, část z nich lze řeší právě zduhatěním algoritmu: pro každý krok se použije jiná funkce hash -> heslo. Pak je ovšem potřeba zkoušet různé polohy hashe v tabulce.
Řečeno přesněji (aneb implementace v Lispu - spíš instruktivní než pro použití):
(defstruct (rainbow-table (:type vector)) rows colors startpoints reducing-function cipher-function) (defun cipher (key table) "Do the hashing step" (funcall (rainbow-table-cipher-function table) key)) (defun reduce-hash (hash color table) "Call reducing function" (funcall (rainbow-table-reducing-function table) hash color)) (defun cipher-and-reduce (key color table) "Returns next key in a row" (reduce-hash (cipher key table) color table)) (defun traverse-chain (start-key start-color table &optional (end-color (colors-in table))) "Return final key for given start key and table" (loop for color from start-color to end-color for key = start-key then (cipher-and-reduce key color table) finally (return key))) (defun setup-rows (table start-keys-generator) "Initialize the table" (let ((start-rows (make-hash-table))) (loop for row from 0 to (1- (rows-in table)) for start-key = (funcall start-keys-generator row) do (setf (gethash (traverse-chain start-key 0 table) start-rows) start-key)) (setf (rainbow-table-startpoints table) start-rows))) (defun lookup-start-key (end-key table) "Return start key to end key, or nil if end key is not in table." (gethash end-key (rainbow-table-startpoints table))) (defun lookup-key (key start-color table) (let ((start-key (lookup-start-key key table))) (when start-key (traverse-chain start-key 0 table (1- start-color))))) (defun decipher (hash table) (loop for start-color from 0 to (1- (colors-in table)) for result = (lookup-key (traverse-chain (reduce-hash hash start-color table) start-color table) start-color table) do (when (and result (eql (cipher result table) hash)) (return result)) finally nil))
Obrana: pořádná hesla (je to pořád jenom brute force attack), solit hashe (pak se hůř předpřiravují tabulky)
Tiskni
Sdílej:
(:conc-name rt-)
„The following functions were used but not defined: ROWS-IN COLORS-IN“
je v pořádku? ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.