I want to generate a bip32 private root key based on bip39 seed. I found an article with python code, copied it to myself and executed it, getting a valid private root key (checked here). Then I wrote a similar script on golang, inserted the seed from the python example into it, and after executing it, I got the wrong root key. The set of bytes, which is then encoded by base58 to obtain the root key, coincided in both scripts, but the result of base58 encoding was different.
Python example:
...
print(all_bytes.hex())
root_key = base58.b58encode_check(all_bytes).decode('utf8')
print(root_key)
Python output:
0488ade400000000000000000060499f801b896d83179a4374aeb7822aaeaceaa0db1f85ee3e904c4defbd9689004b03d6fc340455b363f51020ad3ecca4f0850280cf436c70c727923f6db46c3e
xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U
Golang example:
fmt.Println(hex.EncodeToString(buffer.Bytes()))
rootKey := base58.CheckEncode(buffer.Bytes(), 0)
fmt.Println(rootKey)
Golang output:
0488ade400000000000000000060499f801b896d83179a4374aeb7822aaeaceaa0db1f85ee3e904c4defbd9689004b03d6fc340455b363f51020ad3ecca4f0850280cf436c70c727923f6db46c3e
1xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsUrGUX
As you can see, the bytes that are used for encoding are the same here and there, but the result is different. I tried using another golang module to generate a base58 string, but it generates an error for this seed :/ Maybe someone has encountered something similar and knows how to generate the correct base58 strings in golang