2

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

2 Answers 2

2

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

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.