Ride vs Javascript. Sha256 and base58 encoding/decoding

Hello. I’m trying to write a simple contract that compares given hash with hash(preimage)

Code in smart contract:

hash == toBase58String(sha256(fromBase58String(preimage))) 

JS code to generate hash using waves-crypto library

import wc from 'waves-crypto'
const number = 427655;
const preimage = wc.base58encode(Uint8Array.from(number.toString().split("")));
const hash = wc.base58encode(wc.sha256(Uint8Array.from(code.toString().split("")))

The hash in smart contract is not equal to hash(preimage) in smart contract.

What could be a problem?

Hard to understand, why they should be the same?

Start with simple stuff like:

hash == toBase58String(sha256(fromBase58String("123"))) 

Thanks, @deemru . I found the mistake. I’ve used waves-crypto from npm instead of @waves/waves-crypto. It looks like something changed in sha256

I’ve published a simple example on github: https://github.com/kmadorin/simple-hash.
If someone will be interested.

contract.js - file of a simple contract with a function that checks the hash
deploy.js - deploy script
getHash.js - utility function for getting hash
invoke.js - invoking the function from the contract.