Hi,
I struggle with directory hashing. I want something like this:
/srv/mail/c/cf37a8dff5e360927ba10ab2
The final folder is simpel, as it is:
%{sha256;truncate=96:user}
But how do I get a first level from sha256? Unfortunately, the truncate option aligns only full 8bit and does not divide into low and high nibbles. How can I express this for sha256?
in MD5 this would be %1Mu
Many thanks in advance
Christian
Rößner-Network-Solutions Karl-Bröger-Str. 10, 36304 Alsfeld Fax: +49 6631 78823409, Mobil: +49 171 9905345 USt-IdNr.: DE225643613, https://roessner.website PGP fingerprint: 658D 1342 B762 F484 2DDF 1E88 38A5 4346 D727 94E5
In data lunedì 11 maggio 2020 10:00:38 CEST, lists@mlserv.org ha scritto:
Hi,
I struggle with directory hashing. I want something like this:
/srv/mail/c/cf37a8dff5e360927ba10ab2
The final folder is simpel, as it is:
%{sha256;truncate=96:user}
But how do I get a first level from sha256? Unfortunately, the truncate option aligns only full 8bit and does not divide into low and high nibbles. How can I express this for sha256?
in MD5 this would be %1Mu
Many thanks in advance
Christian
Maybe as a workaround you can create a directory named /srv/mail/c and make 16 symbolic links to it: /srv/mail/c0, /srv/mail/c1, /srv/mail/c2, up to /srv/ mail/cf.
In that way you can use truncate=8.
-- Simone Lazzaris QCom SpA
On 11/05/2020 11:10 Simone Lazzaris s.lazzaris@interactive.eu wrote:
In data lunedì 11 maggio 2020 10:00:38 CEST, lists@mlserv.org ha scritto:
Hi,
I struggle with directory hashing. I want something like this:
/srv/mail/c/cf37a8dff5e360927ba10ab2
The final folder is simpel, as it is:
%{sha256;truncate=96:user}
But how do I get a first level from sha256? Unfortunately, the truncate option aligns only full 8bit and does not divide into low and high nibbles. How can I express this for sha256?
in MD5 this would be %1Mu
Many thanks in advance
Christian
Maybe as a workaround you can create a directory named /srv/mail/c and make 16 symbolic links to it: /srv/mail/c0, /srv/mail/c1, /srv/mail/c2, up to /srv/ mail/cf.
In that way you can use truncate=8.
-- Simone Lazzaris QCom SpA
Out of curiosity, but why do you use SHA256? You get probably no extra benefit from it. I mean, you are free to do so, but ... why?
Anyways, it would work pretty much the same way, %1{sha256:..} and %4{sha256:...}.
Aki
Am 11.05.2020 um 10:16 schrieb Aki Tuomi aki.tuomi@open-xchange.com:
On 11/05/2020 11:10 Simone Lazzaris s.lazzaris@interactive.eu wrote:
In data lunedì 11 maggio 2020 10:00:38 CEST, lists@mlserv.org ha scritto:
Hi,
I struggle with directory hashing. I want something like this:
/srv/mail/c/cf37a8dff5e360927ba10ab2
The final folder is simpel, as it is:
%{sha256;truncate=96:user}
But how do I get a first level from sha256? Unfortunately, the truncate option aligns only full 8bit and does not divide into low and high nibbles. How can I express this for sha256?
in MD5 this would be %1Mu
Many thanks in advance
Christian
Maybe as a workaround you can create a directory named /srv/mail/c and make 16 symbolic links to it: /srv/mail/c0, /srv/mail/c1, /srv/mail/c2, up to /srv/ mail/cf.
In that way you can use truncate=8.
-- Simone Lazzaris QCom SpA
Out of curiosity, but why do you use SHA256? You get probably no extra benefit from it. I mean, you are free to do so, but ... why?
The reason for me was that I could bash script a transition from username to directory:
echo -n "username" | sha256sum | cut -c 1-24
That way I could convert all folders easily. I did not know how to do this with the M-versions.
Anyways, it would work pretty much the same way, %1{sha256:..} and %4{sha256:...}.
Thanks. I will try that out.
Christian
Aki
-- Rößner-Network-Solutions Karl-Bröger-Str. 10, 36304 Alsfeld Fax: +49 6631 78823409, Mobil: +49 171 9905345 USt-IdNr.: DE225643613, https://roessner.website PGP fingerprint: 658D 1342 B762 F484 2DDF 1E88 38A5 4346 D727 94E5
On 11/05/2020 11:21 lists@mlserv.org wrote:
Am 11.05.2020 um 10:16 schrieb Aki Tuomi aki.tuomi@open-xchange.com:
On 11/05/2020 11:10 Simone Lazzaris s.lazzaris@interactive.eu wrote:
In data lunedì 11 maggio 2020 10:00:38 CEST, lists@mlserv.org ha scritto:
Hi,
I struggle with directory hashing. I want something like this:
/srv/mail/c/cf37a8dff5e360927ba10ab2
The final folder is simpel, as it is:
%{sha256;truncate=96:user}
But how do I get a first level from sha256? Unfortunately, the truncate option aligns only full 8bit and does not divide into low and high nibbles. How can I express this for sha256?
in MD5 this would be %1Mu
Many thanks in advance
Christian
Maybe as a workaround you can create a directory named /srv/mail/c and make 16 symbolic links to it: /srv/mail/c0, /srv/mail/c1, /srv/mail/c2, up to /srv/ mail/cf.
In that way you can use truncate=8.
-- Simone Lazzaris QCom SpA
Out of curiosity, but why do you use SHA256? You get probably no extra benefit from it. I mean, you are free to do so, but ... why?
The reason for me was that I could bash script a transition from username to directory:
echo -n "username" | sha256sum | cut -c 1-24
That way I could convert all folders easily. I did not know how to do this with the M-versions.
Anyways, it would work pretty much the same way, %1{sha256:..} and %4{sha256:...}.
Thanks. I will try that out.
Christian
%M = 'echo -n username | md5sum'
The %1 means take first hex nibble.
Aki
participants (3)
-
Aki Tuomi
-
lists@mlserv.org
-
Simone Lazzaris