You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Get the object IDfngit_hash_object(file_content:&[u8]) -> Vec<u8>{let file_size = file_content.len().to_string();let hash_input:Vec<u8> = vec!["blob ".as_bytes(),
file_size.as_bytes(),b"\0",file_content,]// Flatten the Vec<&[u8]> to Vec<u8> with concat.concat();to_sha1(&hash_input)}fnto_sha1(hash_me:&[u8]) -> Vec<u8>{// using [crate sha1](https://docs.rs/sha1/0.6.0/sha1/) version 0.6.0 in to_sha1:letmut m = Sha1::new();
m.update(hash_me);
m.digest().bytes().to_vec()}
IFS read username from stdin as a sequence of bytes assumed to be encoded from characters as per the locale's encoding
if it is not utf-8 use iconv the utf 8 lib convert from locale encoding to UTF-8
The format of a tree object:
tree [content size]\0[Entries having references to other trees and blobs]
The format of each entry having references to other trees and blobs:
[mode] [file/folder name]\0[SHA-1 of referencing blob or tree]
I wrote a script deflating tree objects. It outputs as follows:
tree 192\0
40000 octopus-admin\0 a84943494657751ce187be401d6bf59ef7a2583c
40000 octopus-deployment\0 14f589a30cf4bd0ce2d7103aa7186abe0167427f
40000 octopus-product\0 ec559319a263bc7b476e5f01dd2578f255d734fd
100644 pom.xml\0 97e5b6b292d248869780d7b0c65834bfb645e32a
40000 src\0 6e63db37acba41266493ba8fb68c76f83f1bc9dd
The text was updated successfully, but these errors were encountered:
git is one of the best blockchain implementations that we got today
but its content hash is also based on the filename as you can see in refs/objects/<sha256-1 cont
In Rust:
git entry hash
bash version look if you got utf8 already
if it returns UTF-8
IFS read username from stdin as a sequence of bytes assumed to be encoded from characters as per the locale's encoding
if it is not utf-8 use iconv the utf 8 lib convert from locale encoding to UTF-8
tree object
The text was updated successfully, but these errors were encountered: