<p>In the early versions of bitcoin the software used the openssl bignumber lib to perform left and right shift.</p>
<p>E.g. Look at <code>script.cpp</code> in <a href="https://github.com/bitcoin/bitcoin/releases/tag/v0.2.13" rel="nofollow noreferrer">v0.2.13</a></p>
<p>For example, The <code>OP_LSHIFT</code> (L595) uses <code>bignum.h</code> (L503) and <code>openssl/bn.h</code> to define <code>&lt;&lt;</code> operator and ends up at this definition of lshift:</p>
<p><a href="https://github.com/openssl/openssl/blob/1c0eede9827b0962f1d752fa4ab5d436fa039da4/crypto/bn/bn_shift.c#L104" rel="nofollow noreferrer">https://github.com/openssl/openssl/blob/1c0eede9827b0962f1d752fa4ab5d436fa039da4/crypto/bn/bn_shift.c#L104</a></p>
<p>It seems they were disabled in response to a DoS security concern:
<a href="https://en.bitcoin.it/wiki/Incidents#CVE-2010-5137" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Incidents#CVE-2010-5137</a></p>

CC BY-SA 4.0
2022-09-09T10:49:13.047Z
2022-09-09T11:10:11.273Z
2022-09-09T11:10:11.273Z
Lee
<p>For all intents and purposes, Bitcoin has no such opcodes.</p>
<p>Very early versions of Bitcoin's reference implementation did, until version 0.3.10 (August 2010) when they were disabled together with a number of other opcodes. New opcodes with identical functionality could be re-introduced now with a softfork, but the fact that similar opcodes existed historically wouldn't make that any easier (or harder) - they'd just be new opcodes.</p>
<p>As for what they did: they implemented an operation similar to the &gt;&gt;= and &lt;&lt;= C/C++ style operators, multiplying and dividing by a specified power of two.</p>

CC BY-SA 4.0
2020-07-17T22:45:58.050Z
2020-07-17T23:26:29.497Z
2020-07-17T23:26:29.497Z
Pieter Wuille
<p>What is the purpose &amp; functionalities of the <code>LSHIFT</code> &amp; <code>RSHIFT</code> Script OP codes ?</p>

<script><opcodes>
OP_LSHIFT & OP_RSHIFT purpose & functionality
Bhala T R
# OP_LSHIFT & OP_RSHIFT purpose & functionality

(Asked by: username_0 on 2020-07-17)

What is the purpose & functionalities of the `LSHIFT` & `RSHIFT` Script OP codes ?

**Tags:** script, opcodes


---

## 2 answers

### Answer by username_1 on 2022-09-09. Score: 2 | Accepted answer

In the early versions of bitcoin the software used the openssl bignumber lib to perform left and right shift.

E.g. Look at `script.cpp` in [v0.2.13](https://github.com/bitcoin/bitcoin/releases/tag/v0.2.13)

For example, The `OP_LSHIFT` (L595) uses `bignum.h` (L503) and `openssl/bn.h` to define `<<` operator and ends up at this definition of lshift:

<https://github.com/openssl/openssl/blob/1c0eede9827b0962f1d752fa4ab5d436fa039da4/crypto/bn/bn_shift.c#L104>

It seems they were disabled in response to a DoS security concern:
<https://en.bitcoin.it/wiki/Incidents#CVE-2010-5137>


---

### Answer by username_2 on 2020-07-17. Score: 6

For all intents and purposes, Bitcoin has no such opcodes.

Very early versions of Bitcoin's reference implementation did, until version 0.3.10 (August 2010) when they were disabled together with a number of other opcodes. New opcodes with identical functionality could be re-introduced now with a softfork, but the fact that similar opcodes existed historically wouldn't make that any easier (or harder) - they'd just be new opcodes.

As for what they did: they implemented an operation similar to the >>= and <<= C/C++ style operators, multiplying and dividing by a specified power of two.


---

