APL (Dyalog), 43 bytes
Requires ⎕IO←0
which is default on many systems.
'#',{6⍴(≢⍵)⊃'0'⍵, ⍵(2/⍵)(∊⍵,¨⊃⌽⍵)(⍵,⌽⍵)⍵}1↓⍞
1↓⍞
drop the first character (the hash)
{
apply the following anonymous function
(≢⍵)⊃
use the length of the argument to pick one of the following seven values:
'0'
a zero
⍵
the argument
⍵
the argument
2/⍵
two (2
) of each (/
) of the argument (⍵
)
∊⍵,¨⊃⌽⍵
the flattened (∊
) argument (⍵
) followed each (,¨
) by the first (⊃
) of the reversed (⌽
) argument (⍵
)
⍵,⌽⍵
the argument (⍵
) prepended (,
) to the reversed (⌽
) argument (⍵
)
⍵
the argument
6⍴
repeat elements from that until a length of six is achieved
}
end of anonymous function
'#',
prepend a hash to that