Questions tagged [encoding]
This challenge relates to data expressed under a different representation or language (including encoding, decoding, and processing such data). Some examples of an encoding includes ASCII and UTF-8.
58 questions
5
votes
14
answers
1k
views
Make a Mulenère encryption program
Mulenère cipher is a version of Vigenère ciphers, which uses multiplication instead of addition.
Algorithm
It's simple. First, the password will repeated as much as reach a size bigger than length of ...
3
votes
7
answers
597
views
Decode the constant/variable
To save codepoints, a compute-er can share 0 and -, and share . with ...
-1
votes
1
answer
132
views
Encode in Base64 [duplicate]
Input: a string in a representation supported by your language
Task: Output the string's representation in base64.
code-golf, so fewest bytes in each language wins!
Here's a example base64 encoder in ...
16
votes
21
answers
2k
views
ZigZag encoding and decoding
ZigZag encoding is a method of encoding signed integers to unsigned integers. Non-negative integers are multiplied by two. Negative integers are equal to their absolute values multiplied by two, minus ...
6
votes
11
answers
1k
views
Hex diff encoder
Write a codec that
encodes list of bytes by calculating the difference between the values (0-255) of consecutive bytes, converting those differences to their hexadecimal representation, and ...
12
votes
12
answers
1k
views
Encode a VarInt
Similar question to my previous one, but in reverse. This time I want you to encode an integer into a VarInt.
Background:
I'm not going to assume everyone's seen my previous question, so here is a ...
-1
votes
1
answer
98
views
Function to Convert string to Hexadecimal [duplicate]
Assignment:
Create a function that can convert a string to its encoded hexadecimal value.
In your answer, also show how to run this function (to validate answers).
Your function must return OR print ...
13
votes
27
answers
1k
views
Construct a uInt from an array of bits
Task is simple!
Take an array of binary values (can be boolean, 0/1, etc.) and use those bits to construct an n-th bit long unsigned integer (return type does not need to be an unsigned integer, just ...
2
votes
0
answers
222
views
Golf a PSK31 modulator
Given a string of ASCII text as input, encode it in BPSK31 using Varicode. You may either output an audio file in any common format, or play the audio over the device speakers. You may output at any ...
12
votes
16
answers
3k
views
Encrypting Emojis
Problem
You are tasked with creating a program that performs emoji encryption on a given string of emojis. In this encryption scheme, each emoji is replaced by a unique character (from ...
10
votes
3
answers
399
views
Representing a number as an unordered list of smaller numbers
Suppose we want to encode a large integer \$x\$ as a list of words in such a way that the decoder can recover \$x\$ regardless of the order in which the words are received. Using lists of length \$k\$ ...
14
votes
7
answers
2k
views
Gödel encoding - Part II (decoding)
Part I
Previous part was considered encoding of non-empty nested lists with a positive integer.
Reminding the coding procedure \$G(x)\$:
If \$x\$ is a number, \$G(x) = 2^x\$
If \$x\$ is a list \$[n_0,...
31
votes
18
answers
3k
views
Gödel encoding - Part I
Related but different.
Part II
Taken from the book: Marvin Minsky 1967 – Computation:
Finite and Infinite Machines, chapter 14.
Background
As the Gödel proved, it is possible to encode with a unique ...
13
votes
25
answers
2k
views
Output the length of (the length plus a message) [duplicate]
The task is simple. You're given an arbitrary string message. Return that message prefixed with a number, such that the length of that number plus the message equals the number. In other words, the ...
6
votes
4
answers
385
views
Encoder/Decoder for efficient number storage!
Description
Inspired by this question, write a program/function to encode a number and a program (possibly the same as the first) to decode a bitstream in variable-length encoding as follows (taken ...
19
votes
9
answers
2k
views
ro1000an nu1000era50 en100o501ng
In the hovertext of this xkcd:
There's an "encoding" based on replacing runs of roman numerals with their sums. To do this:
Find all runs of at least 1 roman numeral (...
14
votes
12
answers
2k
views
Nega-Zeckendorf representation
Background
Zeckendorf representation is a numeral system where each digit has the value of Fibonacci numbers (1, 2, 3, 5, 8, 13, ...) and no two consecutive digits can be 1.
Nega-Zeckendorf ...
10
votes
8
answers
944
views
Encode a Lenguage
The Len(language,encoding) family of languages is a variety of Lenguage derivatives. To encode a program into a Len language, you replace every character with its representation in a certain encoding, ...
18
votes
14
answers
2k
views
Encode USB packets (part 2)
Inspired by this video by Ben Eater. This challenge forms a pair with Decode USB packets.
The USB 2.0 protocol uses, at a low level, a line code called non-return-to-zero encoding (specifically, a ...
32
votes
19
answers
3k
views
Decode USB packets
Inspired by this video by Ben Eater. This challenge forms a pair with Encode USB packets.
The USB 2.0 protocol uses, at a low level, a line code called non-return-to-zero encoding (specifically, a ...
6
votes
0
answers
305
views
Build a program that outputs itself encoded as a QR [closed]
The goal is simple. Write a program that outputs itself encoded as a QR code.
A QR code is a way to encode data in a black and white image, similar to a 2D image.
An example implementation can be ...
17
votes
14
answers
1k
views
Implement swap encoding
Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters.
The basic algorithm
For each character in the string:
Check: ...
25
votes
27
answers
2k
views
Decode Polybus Square/Tap Code/Prison Code
The code has a lot of names, but is very simple:
1 2 3 4 5
1 A B C D E
2 F G H I J
3 L M N O P
4 Q R S T U
5 V W X Y Z
A letter is coded by its coordinates, ...
10
votes
11
answers
1k
views
Elias omega coding: decoding
Related: Elias omega coding: encoding
Background
Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits.
Given a stream of bits \$S\$, the decoding ...
24
votes
29
answers
3k
views
Elias omega coding: encoding
Background
Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits.
Given a positive integer \$N\$, the encoding algorithm is as follows:
Start ...
36
votes
12
answers
3k
views
Store eight bits on a punched card
A little while back, data was frequently stored on punched card. A typical card would have 80 columns of 12 possible 'punch' positions. A plethora of encodings was used, each for their own specific ...
10
votes
6
answers
514
views
Japanese Encoding Conversion
Background
In JIS X 0208 a 94 by 94 map (kuten (区点)) is defined to encode Chinese characters (kanji), phonetic moras (kana) and other symbols. Along with this standard there are 3 different encodings ...
1
vote
1
answer
296
views
Find all possible dates [closed]
You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but ...
-2
votes
13
answers
739
views
Decode an URL string
Challenge
I think everyone of us heard of URL encoding mechanism - it's basically everywhere.
Given an URLEncoded string on stdin, decode it, and output the decoded form to stdout.
The encoding is ...
8
votes
13
answers
778
views
Mis-decode a date
Background
Inspired by a now deleted question by John Burger from which I quote:
Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: ...
17
votes
19
answers
3k
views
Clock (transliterate) Cipher
Introduction:
I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
19
votes
13
answers
2k
views
Trifid Cipher (without keyword)
Introduction:
I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard)...
16
votes
14
answers
2k
views
Computer Cipher
Introduction:
I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard)...
17
votes
19
answers
4k
views
Decode a 7-segment display
You probably all know the 7-segment display which can display among other things all digits from \$0\dots 9\$:
Challenge
We only consider the segments \$\texttt{A}\dots\texttt{G}\$, your task is to ...
23
votes
23
answers
4k
views
Encode - Shuffle - Decode
Challenge
Your task is to encode an integer as a string of ASCII characters, then successfully decode it after said string has been randomly shuffled.
You will write two programs/functions, which ...
8
votes
5
answers
986
views
Permutation Encoding
Write a program which can encode text to avoid reusing characters, and convert back.
Both normal and encoded forms are restricted to a particular character set: the space character ...
6
votes
1
answer
160
views
Bijection: tree-like lists - natural numbers [duplicate]
We define a tree-like list, or trist for short, as the empty list or a list containing only previously constructed trists.
The natural numbers can either include 0 or not, according to your ...
25
votes
12
answers
3k
views
Bake me some moji
Given a string, character list, byte stream, sequence… which is both valid UTF-8 and valid Windows-1252 (most languages will probably want to take a normal UTF-8 string), convert it from (that is, ...
52
votes
12
answers
9k
views
Professor at MIT can read minds!
The task is taken from an MIT lecture by Prof. Devadas called You can read minds. A detailed explanation of the trick can be found in the linked video, or in this document. I'll try to explain it in ...
16
votes
10
answers
2k
views
Prime Factor Encoding
How the encoding works
Given a list of bits:
Hold a prime (starting with 2)
Have a list
For each bit in the input
If it's the same as the previous bit, add the ...
8
votes
3
answers
680
views
Compress to Impress
Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "...
15
votes
11
answers
2k
views
Balanced Zero-One Encoding
Task
Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple!
...
37
votes
18
answers
4k
views
Bracket Expansion!
Your challenge is to expand some brackets in a program's input as shown:
Find a string s between two matching brackets [ and ], ...
5
votes
1
answer
1k
views
Decode my I2C Stream!
From the sandbox!
I2c or TWI, is a 2 way stream that uses 2 signal lines: SDA and SCK. This is used in sensors to communicate ...
10
votes
1
answer
661
views
Braincopterify an image
Introduction
Braincopter is an esoteric Brainf*** derivative that encodes a Brainf***
program as an image. As a 2D language, it uses two additional commands; they
rotate the instruction pointer (...
33
votes
6
answers
4k
views
Telegraphy Golf: Decode Baudot Code
Background
In 1870 Émile Baudot invented Baudot Code, a fixed-length character
encoding for telegraphy. He designed the code to be entered from a
manual keyboard with just five keys; two operated with ...
8
votes
1
answer
444
views
Double run-length encoding
Everyone knows what run-length encoding is. It has been the subject of many code-golf challenges already. We'll be looking at a certain variation.
Example
...
9
votes
4
answers
1k
views
Implement an encoder for RFC 1924 IPv6 Addresses
Introduction
Everyone should know IPv6 by now. IPv6 has very long, cumbersome addresses.
In 1996 some very intelligent people created a scheme to encode them much better in RFC 1924. For reasons I ...
14
votes
7
answers
1k
views
Code the Huffman!
Or else he will huff and puff and blow your house down!
That was completely irrelevant. This challenge is actually about Huffman coding. The gist of it is the frequency of characters in a given text ...
34
votes
16
answers
2k
views
Have you learned your fib-abc?
I don't like numbers, but I do like the Fibonacci sequence. I'm sure we could work something out.
Please read one integer n from STDIN and output the nth Fibonacci number in base 26 (...