Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Decoding the hidden message in Perseverance parachute with R
library(tidyverse)
options(warn = -1) # suppress warnings
# read in the rings as character strings
ring <- data.frame(inner_ring = "00000001000000000001000001001000000001010001111111111111111111111111111111111111",
middle_ring_first = "00000011010000001001000000011100000010000000010100000001100100011111111111111111",
middle_ring_second = "00000101000000001000000000100100000011100000000111000001001100011111111111111111")
end <- seq(10, 80, by = 10) # create vector of upper bound for each chunk of 10 bits
ring %>%
pivot_longer(cols = 1:3, names_to = "ring", values_to = "char") %>%
separate(col = char, into = paste0("chunk ", 1:8), sep = end) %>% # split in chunks of 10 bits
mutate(across(starts_with("chunk"), strtoi, base = 2), # convert binary string to integer
across(starts_with("chunk"), ~ . + 64), # add 64 to get ascii code
across(starts_with("chunk"), gtools::chr)) # return character corresp to ascii code
@oliviergimenez
Copy link
Author

The output is: res

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment