'Sumation hash and key value in python

I try to sum hash + Key to gain new hash value.

The key value:

a= "111631279578723877696242174"

The Hash Value by SHA-256:

b = "7de8c9d1ce09fd2554fc0468ae52d5144800d3ae3ae9b075a3ba4494e5e55f50"

My idea is to convert them to a binary value and sum the two but I got an error:

V1= list(map(bin, bytearray(a, "utf-8")))
V2=list(map(bin, bytearray(b, "utf-8")))
sum = bin(int(V1, 2) + int(V2, 2)) 

The error:

TypeError: int() can't convert non-string with explicit base

How can I solve this error, or if any another way to combine the key and hash?



Solution 1:[1]

i come up with this method to combine them:

>>> key=b'pvvFgKElhtkbDt0Lt7gOlcR4Kzwohz1UWZ8UzM2FKLg='
>>> _hash=b'gAAAAABiQX2cDIWlX4ySuBjkZsMyO09RiS0HJXEb7NvqfRbwj2W0rxko_fp1murmm6T1ZaE-dSkDOGNm1yA7bsq-rjXeiM-ckg=='
>>> hex(int.from_bytes(key,'little')+int.from_bytes(_hash,'little')).removeprefix("0x")

result:

'3d3d6734373347716c355342313549617a2d4b697357527347384b495f49723132635a6c62436a6b6768586e66486950735265487650723783a99c90a57495f0aa819ea5c96abd99d6cfcb7c78aaabb2b39c8fbec175bdb38f9eccb9d5878ca887b7b7d7'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 XxJames07-