how to make scalar 4 from binary in python

Viewed 21

so i want to make scalar 4 code. for example

input = 0101, 1100 output = 0000111100001111, 1111111100000000

so every 1 binary input will be duplicate 4 times like the example.

but i got error:

can only concatenate str (not "int") to str

i want to save the output to array, maybe something wrong when i want to make array. so please help me to fix it.

here's the full code:

password = b'S\x92\x9b\xf2'

//first, the bytes password will be convert to binary
def biner(password):
    print(password)
    password[0]
    li = []
    for my_byte in password:
        if my_byte != None:
            string_output = ' '.join(f'{my_byte:0>8b}' for my_byte in password)
            li.append(string_output)
    
            return li, len(string_output.split(' '))

//second, the result from func biner, will be get in func skalar
//func skalar should make binary to duplicate 4 times
def skalar(biner, jum):
    besaran = 4

    jumbin = biner
    print(biner)

    for a in range(0, jum):
        keluar = jumbin[a]
        keluar += a * besaran
        jumbin[a] = keluar
    return jumbin
0 Answers
Related