How does Couchdb calculates the document revision number

couchbasecouchdb

Whats the exact algorithm to calculate the CouchDB revision number.
CouchDB uses a deterministic algorithm to calculate the document revision number.
Here is one relevant doc I found:
https://stackoverflow.com/questions/5954864/how-does-couchdb-calculate-the-revision-number

Buts its all in elrang, I am trying to implement it in dart.
I use sample document : {"_id":"123-this-is-an-id","hello":"world","testing":123} for testing.

When I do the MD5 hash of it , its gives me : f0853833850bce08dce0896e010a375e, where as the couchdb revision number is :

"_rev": "1-43dce8fe7e9a26b49390e3727a015cc0"

I google it everywhere, but if I can find the algorithm some where in text , UI can convert it into dart.

Best Answer

So after some time, I got to know that couchdb calculates revision number as such:

seq_num-md5HashOfDocJsonContentWithoutRevField