Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

He keeps differentiating, flying off on a tangent.


devel / sci.crypt / Efficient dword bitwise rotate / circular shift using Bash shell ?

SubjectAuthor
* Efficient dword bitwise rotate / circular shift using Bash shell ?SugarBug
`* Re: Efficient dword bitwise rotate / circular shift using Bash shell ?Phil Carmody
 `- Re: Efficient dword bitwise rotate / circular shift using Bash shell ?Jakob Bohm

1
Efficient dword bitwise rotate / circular shift using Bash shell ?

<41c2930d8ad16c2b1ecf5263b0dd2ee8$1@sybershock.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=948&group=sci.crypt#948

  copy link   Newsgroups: sci.crypt
Path: i2pn2.org!.POSTED!not-for-mail
From: 3883@sugar.bug (SugarBug)
Newsgroups: sci.crypt
Subject: Efficient dword bitwise rotate / circular shift using Bash shell ?
Date: Sat, 4 May 2024 09:24:12 -0500
Organization: Baggy Jeans Mafia (sybershock.com)
Message-ID: <41c2930d8ad16c2b1ecf5263b0dd2ee8$1@sybershock.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: i2pn2.org;
logging-data="63733"; mail-complaints-to="usenet@i2pn2.org";
posting-account="yZybWhCr+jI4C3MuGpPde+DhCwsjQrVZrsCOigcx7fM";
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: SugarBug - Sat, 4 May 2024 14:24 UTC

Example:

rol() { num="$@" ; pre=$((num<<13)) ; suf=$((num>>19)) ;
num=$((pre^suf)) ; num=$((num&0xffffffff)) ; echo "$num" ; }

What tricks will make this more efficient in Bash?

--
www.sybershock.com | sci.crypt | alt.sources.crypto | alt.lite.bulb

Re: Efficient dword bitwise rotate / circular shift using Bash shell ?

<87pltsicl7.fsf@fatphil.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=976&group=sci.crypt#976

  copy link   Newsgroups: sci.crypt
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pc+usenet@asdf.org (Phil Carmody)
Newsgroups: sci.crypt
Subject: Re: Efficient dword bitwise rotate / circular shift using Bash shell ?
Date: Sat, 11 May 2024 18:37:40 +0300
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <87pltsicl7.fsf@fatphil.org>
References: <41c2930d8ad16c2b1ecf5263b0dd2ee8$1@sybershock.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sat, 11 May 2024 17:53:28 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="58f9969d45a193b121b3ab396f9e3aab";
logging-data="2228599"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Cqh6DC8z7nHVrzgsjn+E6"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:0ZuA9JeQOm2zhct5aXE1ea+Yagk=
sha1:Sb72BD1vl0vMl9W9lYWuKlDEhH0=
 by: Phil Carmody - Sat, 11 May 2024 15:37 UTC

SugarBug <3883@sugar.bug> writes:
> Example:
>
> rol() { num="$@" ; pre=$((num<<13)) ; suf=$((num>>19)) ;
> num=$((pre^suf)) ; num=$((num&0xffffffff)) ; echo "$num" ; }
>
> What tricks will make this more efficient in Bash?

If you can be sure the input will never be 0xffffffff, then this should
work:

rol () { echo "$(($1*8192%0xffffffff))" ; }

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

Re: Efficient dword bitwise rotate / circular shift using Bash shell ?

<v226he$rhfh$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=981&group=sci.crypt#981

  copy link   Newsgroups: sci.crypt
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jb-usenet@wisemo.invalid (Jakob Bohm)
Newsgroups: sci.crypt
Subject: Re: Efficient dword bitwise rotate / circular shift using Bash shell
?
Date: Wed, 15 May 2024 13:33:01 +0200
Organization: WiseMo A/S
Lines: 32
Message-ID: <v226he$rhfh$1@dont-email.me>
References: <41c2930d8ad16c2b1ecf5263b0dd2ee8$1@sybershock.com>
<87pltsicl7.fsf@fatphil.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 15 May 2024 13:33:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1503ffb5db1e25921e8c7f398f0bbf25";
logging-data="902641"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cY5PkuVmFH9r8z48WVzENJnz86bJjBuQ="
Cancel-Lock: sha1:jJG5wqt4vTX5zJoJQUs+Si9f+Xg=
Content-Language: en-US
In-Reply-To: <87pltsicl7.fsf@fatphil.org>
X-Mailer: Epyrus/2.1.2
 by: Jakob Bohm - Wed, 15 May 2024 11:33 UTC

On 2024-05-11 17:37, Phil Carmody wrote:
> SugarBug <3883@sugar.bug> writes:
>> Example:
>>
>> rol() { num="$@" ; pre=$((num<<13)) ; suf=$((num>>19)) ;
>> num=$((pre^suf)) ; num=$((num&0xffffffff)) ; echo "$num" ; }
>>
>> What tricks will make this more efficient in Bash?
>
> If you can be sure the input will never be 0xffffffff, then this should
> work:
>
> rol () { echo "$(($1*8192%0xffffffff))" ; }
>
> Phil
>

rol13() { printf '0x%X' $(((($1<<13)+($1>>19))&0xffffffff))
}

Avoids that limitation, but may be slightly slower depending on bash
inefficiencies.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded


devel / sci.crypt / Efficient dword bitwise rotate / circular shift using Bash shell ?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor