gchq / gchq/CyberChef

Misc: How can I use the bit shift left operation?

Open
#1,480 1 comment 2 reactions 0 assignees View on GitHub
feature improvement
Dominant language
JavaScript
Stars
35.8k
Forks
4.1k
Avg merge
2d 26m
Merged PRs (30d)
33

Description

When bit shifting, the scope is at byte level so I cannot do more than 8 bits. Otherwise, I always get a 0.

For example, when the input is 1, shifting 7 bytes to the left works as expected. At least, I have a non-null result:
https://gchq.github.io/CyberChef/#recipe=Bit_shift_left(7)To_Hex('Space',0)&input=MQ

However, when the bit shift is greater than 7 I get 0:
https://gchq.github.io/CyberChef/#recipe=Bit_shift_left(9)To_Hex('Space',0)&input=MQ

But 1 << 9 = 512, as you can check on https://bit-calculator.com/bit-shift-calculator

How can I get that in cyberchef? Is there any documentation where I can look at to understand how the numbers are stored? Sometimes they are stored in "bytes", sometimes in regular number.

Contributor guide

Open the contributing guide

Research direction

Start with the Bit shift left operation and the two linked CyberChef recipes, then review any user-facing documentation for how input bytes and numeric values are represented. Clarify the behavior for shifts above seven bits and use the examples to verify that the explanation matches the operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.