Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Rollback to Revision 1
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Vyxal, 1416 bytes

Lp8β1LbLEτḢꜝ‹İb8∆Zf0LbLẇvBꜝ‹İ∑

Try it Online!

Avoiding binary completely. Thanks to @KevinCruijssen for spotting a bug.Try it Online!

Lp # Prependb length of encoder key to digits (for 0-padding)
 8β  # Convert fromeach basefrom 256binary
 8∆Z τ # ConvertPad each to base:length 8
 f # Encoder# key...
Flatten
 E  # 2 to the power of
  LbL # Split into #chunks Bitof length of... 1 0LbL # Encoder key
  Length of the encoder string, in #binary
 Remove the padding character.
 vBꜝ‹ # Convert ꜝ‹each from #binary, Removeremove 0s and decrement
 İ İ∑ # Index those into inputthe stringencoder and sum

Vyxal, 14 bytes

Lp8β1LbLEτḢꜝ‹İ

Try it Online!

Avoiding binary completely. Thanks to @KevinCruijssen for spotting a bug.

Lp # Prepend length of encoder key to digits (for 0-padding)
 8β  # Convert from base 256
 τ # Convert to base:
 # Encoder key...

 E  # 2 to the power of
 LbL # Bit length of... 1 # Encoder key
   # Remove the padding character.
 ꜝ‹ # Remove 0s and decrement
 İ # Index into input string

Vyxal, 16 bytes

b8∆Zf0LbLẇvBꜝ‹İ∑

Try it Online!

b # Convert each from binary
 8∆Z # Pad each to length 8
 f # Flatten
  # Split into chunks of length... 0LbL # Length of the encoder string, in binary
 vBꜝ‹ # Convert each from binary, remove 0s and decrement
  İ∑ # Index those into the encoder and sum
added 63 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Vyxal, 1314 bytes

Lp8β15bLE↲ǔτḢLp8β1LbLEτḢꜝ‹İ

Try it Online! Try it Online!

Avoiding binary completely. Thanks to @KevinCruijssen for spotting a bug.

Lp # Prepend length of encoder key to digits (for 0-padding)
 8β # Convert from base 256
 τ τ # Convert to string base:
 1 # Encoder key...
 E  # Padded# right2 to length...
 the power of
 ELbL # 2 to# theBit powerlength of...
 1 5bL # Bit length of# encoderEncoder key
 ǔ # ShiftRemove the wholepadding thingcharacter.
 right for indexing ꜝ‹ # Remove 0s and decrement
  İ # RemoveIndex theinto paddinginput character.string

Vyxal, 13 bytes

Lp8β15bLE↲ǔτḢ

Try it Online!

Avoiding binary completely

Lp # Prepend length of encoder key to digits (for 0-padding)
 8β # Convert from base 256
 τ # Convert to string base:
 1 # Encoder key...
  # Padded right to length...
 E # 2 to the power of
 5bL # Bit length of encoder key
 ǔ # Shift the whole thing right for indexing
  # Remove the padding character.

Vyxal, 14 bytes

Lp8β1LbLEτḢꜝ‹İ

Try it Online!

Avoiding binary completely. Thanks to @KevinCruijssen for spotting a bug.

Lp # Prepend length of encoder key to digits (for 0-padding)
 8β # Convert from base 256
 τ # Convert to base:
 # Encoder key...
 E # 2 to the power of
 LbL # Bit length of...
 1 # Encoder key
  # Remove the padding character.
  ꜝ‹ # Remove 0s and decrement
 İ # Index into input string
added 77 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

Vyxal, 1613 bytes

b8∆Zf0LbLẇvBꜝ‹İ∑Lp8β15bLE↲ǔτḢ

Try it Online! Try it Online!

Avoiding binary completely

b Lp # Prepend length #of Convertencoder eachkey fromto binary
digits 8∆Z(for 0-padding)
  # Pad eachConvert tofrom lengthbase 8256
 f τ # Convert to #string Flattenbase:
 1  # Encoder key...
 # Split into chunks of ↲ # Padded right to length...
 0LbL E # Length2 ofto the encoderpower string,of
 in binary
 5bL # vBꜝ‹Bit length of #encoder Convertkey
 each from binary, remove 0s and decrement
 ǔ # Shift the whole thing right for indexing
 İ∑ # Index those into the encoder and sum Ḣ # Remove the padding character.

Vyxal, 16 bytes

b8∆Zf0LbLẇvBꜝ‹İ∑

Try it Online!

b  # Convert each from binary
 8∆Z # Pad each to length 8
 f # Flatten
  # Split into chunks of length...
 0LbL # Length of the encoder string, in binary
 vBꜝ‹ # Convert each from binary, remove 0s and decrement
 İ∑ # Index those into the encoder and sum

Vyxal, 13 bytes

Lp8β15bLE↲ǔτḢ

Try it Online!

Avoiding binary completely

Lp # Prepend length of encoder key to digits (for 0-padding)
  # Convert from base 256
 τ # Convert to string base:
 1 # Encoder key...
 ↲ # Padded right to length...
 E # 2 to the power of
 5bL # Bit length of encoder key
 ǔ # Shift the whole thing right for indexing
  Ḣ # Remove the padding character.
Rollback to Revision 1
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257
Loading
added 109 characters in body
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257
Loading
Source Link
emanresu A
  • 46.2k
  • 5
  • 111
  • 257
Loading

AltStyle によって変換されたページ (->オリジナル) /