[Question]
  [
Help! I just logged into Stack Exchange, but I forgot what my password is! I need a way to work it out before I log off. 
Luckily, I'm an excellent hacker. Not only was I able to find my password's hash, but I also found Stack Exchange's hashing algorithm! It takes the ASCII value of each digit multiplied by that digit's place, then sums all those values together. For example:
```
"135" -> 1*49 + 2*51 + 3*53 = 310
```
I remember that my password is 3 digits long, and that each character is a number between 0 and 5 inclusive (such that it will match the regex: `^[0-5]{3}$`), but that's still too many possibilities to guess. I need a program that can convert a hash back into potential passwords, but despite being an expert hacker, I can't code to save my life! I was able to write these tests out by hand though:
```
input -> output
288   -> 000                      // lowest possible hash
290   -> 200, 010
298   -> 022, 050, 103, 131, 212, 240, 321, 402, 430, 511   
318   -> 555                      // highest possible hash
```
Can one of you write a program for me that will take in a hash and print all the possible passwords I could have used? 
The input will always be able to produce at least one valid password. Any output format is allowed, as long as the strings can be clearly identified. I'm also not concerned about leading zeroes, so if a potential password is `001`, I'll also accept `01` or `1`. 
Please help me from being locked out of Stack Exchange!
### Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in each language wins!
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
```
5Ý3ãʒÇƶOQ
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f9PBc48OLT0063H5sm3/g//9GlhYA "05AB1E – Try It Online")
Returns list of lists of digits.
[Answer]
# [C](https://gcc.gnu.org), ~~113~~ 108 bytes
```
f(int h){int i=47,j,k;while(++i<54)for(j=47;++j<54)for(k=47;++k<54;)if(h==i+j+j+k*3)printf("%c%c%c",i,j,k);}
```
It is unique to see what is meant for output, the output is of the format: 200010
All passwords are written as 3-digits without delimiter.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 16 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
Ṿ€Oæ.J
6Ḷṗ3Ç⁼¥Ðf
```
A monadic link returning a list of lists of digits.
**[Try it online!](https://tio.run/##ASsA1P9qZWxsef//4bm@4oKsT8OmLkoKNuG4tuG5lzPDh@KBvMKlw5Bm////Mjkw "Jelly – Try It Online")**
### How?
```
Ṿ€Oæ.J - Link 1, hash: list of integers (the digits of a password)
Ṿ€     - unevaluate €ach (giving a list of characters)
  O    - cast to ordinals (Ṿ€O could actually be replaced with +48 too)
     J - range of length (i.e. [1,2,3] in all use-cases)
   æ.  - dot product
6Ḷṗ3Ç⁼¥Ðf - Main link: number, n
6Ḷ        - lowered range of 6 = [0,1,2,3,4,5]
  ṗ3      - Cartesian power with 3 = [[0,0,0],[0,0,1],...,[5,5,5]] (all passwords)
       Ðf - filter keep if:
      ¥   -   last two links as a dyad (right implicitly n):
    Ç     -     call last link (1) as a monad
     ⁼    -     equals right?
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~126~~ 75 bytes
-2 thanks to @ArnoldPalmer
```
lambda h:[(P/36,P%36/6,P%6)for P in range(216)if P/36+P%36/6*2+P%6*3==h&31]
```
[Try it online!](https://tio.run/##LY3BDoIwDIbP8BS9KAxJEJYsSsIRr3LwJh4mbkKCYykjwtPjpp7ar/3aXy@mHVS2yqJee/66Pzi0@TWsEsriakNZ4gojckCooFOAXD1FmKWMdBKctftZUWYbFtGiaLc0va0Gl9z33m3XC7jgJCx4MxT2hZ5MSCxp7JSBoFZBDLNlF8Hje9y4GBnOxJ38re/cF3MjtIHyfCoRB7R7zcdxpenez46HDw "Python 2 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 20 bytes
```
'0':'5'3Z^t3:*!si=Y)
```
[Try it online!](https://tio.run/##y00syfn/X91A3UrdVN04Kq7E2EpLsTjTNlLz/38jSwsA "MATL – Try It Online")
### Explanation
```
'0':'5'   % Push inclusive range from '0' to '5', that is, '012345'
3Z^       % Cartesian power with exponent 3. Each Cartesian tuple is a row
t         % Duplicate
3:        % Push [1 2 3]
*         % Multiply element-wise with broadcast
!s        % Sum of each row
i         % Input number
=         % Logical mask of values that equal the input
Y)        % Use as logical index into the rows of the matrix. Implicit display
```
[Answer]
# [Python 2](https://docs.python.org/2/), 81 bytes
```
lambda h:[(a,b,c)for a in r for b in r for c in r if a+2*b+3*c+288==h]
r=range(6)
```
[Try it online!](https://tio.run/##RY2xDoIwFEVn@Iq30QKDQmIISUdcXdzEodRim2BpHiXC12OLJm73vPtujl2dGk2x9azdBv7qHhxUfSM873JB@xGBgzaAEGL3j@IbdQ88K9IuK1ORFVXFmLrHyJCbpyQnujlc6zh6Kz1IuOIsPUQLMD@2syPUk0VtHCStSXJYPO/KIA@Cniw0TH5f@z2Wi5DWQXM5N4gj@t7yadrK4@ED "Python 2 – Try It Online")
[Answer]
## Haskell, ~~71~~ ~~70~~ ~~64~~ 61 bytes
```
l=[0..5]
f p=[show=<<[a,b,c]|a<-l,b<-l,c<-l,p-288==a+2*b+3*c]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P8c22kBPzzSWK02hwDa6OCO/3NbGJjpRJ0knObYm0UY3RycJRCSDiAJdIwsLW9tEbSOtJG1jreTY/7mJmXkKtgop@VwKCgoFRZl5JQoqCmkKQGVoApYG6AJoKowNLf4DAA "Haskell – Try It Online")
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform),133 131 125 123 bytes
```
n=>{int i,j,k;for(i=48;i<54;++i)for(j=48;j<54;++j)for(k=48;k<54;++k)if(i+j*2+k*3==n)Console.Write($"{i%48}{j%48}{k%48},");}
```
[Try it online!](https://tio.run/##fcuxCsIwGATgPU8RRCGxVdRWqKQRxFUnB@cSY/mTmmATBQl99mrq5OJyHN9xws2EbWX/cGBqfHo5L28MiaZyDt8Dcr7yIPDTwgUfKzCEBrQTHqwpwfhtzXvDt@FTMaQq1exqWwI8LxiU65wlCdAoKor6ihpER9Ff0RSuBBI1XSV6mnFu6N4aZxs5P7fgJRmPAkzyogtqSB0zHVHW9QzVZFUUlKGfxwGMJHQYN4t/459ntoxj1/Vv "C# (.NET Core) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 33 bytes
```
Ｆ⁶Ｆ⁶Ｆ⁶¿⁼⁺℅Ｉι⁺×℅Ｉκ²×℅Ｉλ³Ｉθ«ＩιＩκＩλ⸿
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9nmWPGrchk4f2P2rc86hx16OW1vd7Vp7bCWQeng7l7Dq0Cc7efWgziNpxaDVYGVgaLP5ox/7//40sLQA "Charcoal – Try It Online")
A similar approach to other answers: loop thrice from 0 to 5, calculate the hash and print the state of the iteration variables if it coincides with the input hash.
Link to the [verbose version](https://tio.run/##S85ILErOT8z5/z8tv0hBw0yTS0EBwUJlKyhkpilouBaWJuYUazimpGjkF6VoOCcWl2hkamrqKIBEQjJzU4sR4tlAcSOgFJpwDlDYWBOkB8wtBDIVqqFWKCgEFGXmlcDNtcYmno1DPAdTXCmmSAkuWPv/v5GlxX/dsv@6xTkA).
[Answer]
# [CJam](https://sourceforge.net/p/cjam), ~~26~~ 25 bytes
*-1 byte thanks to Challenger5*
```
{:H;6Zm*{s:i3,:).*:+H=},}
```
Anonymous block expecting the hash on the stack (as an integer) and leaves the result on the stack (as a list of strings).
[Try it online!](https://tio.run/##S85KzP1flPm/2srD2iwqV6u62CrTWMdKU0/LStvDtlan9n9dwX8jSwMA "CJam – Try It Online")
### Explanation
```
:H;    e# Store the hash in H.
6Zm*   e# 3rd Cartesian power of [0 1 2 3 4 5].
{      e# For each tuple in the power:
 s     e#  Stringify the tuple.
 :i    e#  Get the code point of each digit.
 3,:)  e#  Push [1 2 3].
 .*    e#  Element-wise multiplication of the two lists.
 :+    e#  Sum the result.
 H=    e#  Check if it's equal to the hash.
},     e# Filter the tuples to only ones for which this block gave a truthy result.
```
[Answer]
# Java, 162 Bytes
```
static void f(int n){for(int i=48;i<54;i++){for(int j=48;j<54;j++){for(int k=48;k<54;k++){if(i+j*2+k*3==n)System.out.println((char)i+""+(char)j+""+(char)k);}}}}
```
[Answer]
## JavaScript (Firefox 30-57), 72 bytes
```
n=>[for(i of s="012345")for(j of s)for(k of s)if(n-i-j*2-k*3==288)i+j+k]
```
[Answer]
# Pyth, 18 bytes
```
fqQs*VS3CMT^jkU6 3
```
[Answer]
# [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), 40 bytes
```
[0,5|[0,5|[0,5|~a+b+b+c+c+c+288=:\?a,b,c
```
## Explanation
```
[0,5|                Make a FOR loop run through the possible digits for pos 1, called a
[0,5|                Loop for #2, b
[0,5|                Loop for #3, c
                     Calculate the hash by taking a once, b twice and c thrice, 
                     and raising all to their ASCII codepoints
 a+b+b+c+c+c+288       
~               =:   IF thta is euqal to the given hash (read from cmd line)
\?a,b,c              THEN print the digits
                     (the IF and the FOR loops are auto-closed by QBIC)
```
[Answer]
# [R](https://www.r-project.org/), ~~67~~ ~~62~~ 61 bytes
*-5 bytes thanks to Jarko Dubbeldam*
```
b=t(t(expand.grid(rep(list(0:5),3))));b[b%*%1:3==scan()-288,]
```
[Try it online!](https://tio.run/##K/r/P8m2RKNEI7WiIDEvRS@9KDNFoyi1QCMns7hEw8DKVFPHWBMIrJOik1S1VA2tjG1ti5MT8zQ0dY0sLHRi/xtZGvwHAA "R – Try It Online")
reads the number from `stdin`; returns a matrix where the rows are the characters.
It generates all possible trios of digits in a matrix format (`b`), computes the matrix product `b * [1,2,3]`, takes the rows of `b` which match (subtracting `288` from the input which is `1*48+2*28+3*48`) and returns them.
]