Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on Beaver Code Decryption

Parent

Beaver Code Decryption

+6
−0

Credit

This challenge is taken with permission from https://www.mysterytwisterc3.org/en/challenges/level-1/beaver-code

Description

The encryption method is as follows:

The plaintext is divided into two halves, odd positions and even positions.

Example: 'CRYPTO' -> ['CYT','RPO']

This is then applied recursively to both halves, until each part is two letters or less. The parts are then merged.

'CRYPTO' -> ['CYT','RPO'] -> [['CT','Y'], ['RO','P']] -> 'CTYROP'

Challenge

Given a string encrypted with this method, decrypt it.

Valid input formats: ['CTYROP'], 'CTYROP'

Test cases

CTYROP -> CRYPTO
EOYCTNNPRI -> ENCRYPTION
RUOENFSEAFMRDHT -> RANDOMSTUFFHERE

Note: the encryption of the last test case is the same as the decryption, make sure you're decrypting!

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (1 comment)
Post
+3
−0

Solutions by ngn

https://chat.stackexchange.com/transcript/message/57690032#57690032

APL 17: {⍵[⍋⍋⍉⊖2⊥⍣¯1⍳≢⍵]}

ngn/k 13: {x@<<+|2\!#x}

These are too good not to post.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

General comments (3 comments)
General comments
user‭ wrote about 3 years ago

These look awesome. Do you have explanations?

Razetime‭ wrote about 3 years ago

The chat says it assumes input length is under some limit?

rak1507‭ wrote about 3 years ago

These don't assume that. The explanation is based on the fact this is a bit reversal permutation https://en.wikipedia.org/wiki/Bit-reversal_permutation