Rubin (40 znaków)
Interpretuj ciąg liter az jako liczbę w podstawie 26, gdzie a = 1, b = 2, ..., z = 26.
„Hasło” można więc traktować jako liczbę N =
16*(26**7) +
1*(26**6) +
19*(26**5) +
19*(26**4) +
23*(26**3) +
15*(26**2) +
18*(26**1) +
4*(26**0)
Jeśli pozwolimy s = "a"(to znaczy: 1) i wykonamy (N-1) wywołania do s.succ!, s będzie "password"(N). Innymi słowy, N = 1 + (N-1).
For an example that will run more quickly, to prove the calculation of N is correct, consider "pass" as the target, where N is
16*(26**3) +
1*(26**2) +
19*(26**1) +
19*(26**0)
and
s = "a"
(N-1).times { s.succ! }
puts s #== "pass"
Since we want to print "a" too, we need
s = "`"
N.times { print(s.succ! + " ") }
So back to the full "password". N = 129052722140, leaving:
s=?`;0x1e0c2443dc.times{$><<s.succ!+" "}
I hunted for a more compact form of 129052722140 == 0x1e0c2443db but couldn't find one.
(Updated to fix the lack of printing "a", thanks to Cary.)