This tutorial walks you through installing iscc-lib, generating your first ISCC code, and
understanding the result. By the end, you will know how to create content identifiers for metadata,
text, and binary data.
You need a working development environment for your language of choice. iscc-lib supports Python
3.10+, Rust, Node.js, Java 17+, Go 1.21+, and WebAssembly.
The simplest way to create an ISCC is from content metadata. Use gen_meta_code_v0 with a title and
optional description:
fromiscc_libimportgen_meta_code_v0result=gen_meta_code_v0(name="The Neverending Story",description="A novel by Michael Ende",)print(result.iscc)# ISCC code string, e.g. "ISCC:AAA..."print(result.name)# Normalized nameprint(result.metahash)# BLAKE3 hash of the metadata
useiscc_lib::gen_meta_code_v0;letresult=gen_meta_code_v0("The Neverending Story",Some("A novel by Michael Ende"),None,64,)?;println!("{}",result.iscc);// "ISCC:AAA..."println!("{}",result.name);// Normalized nameprintln!("{}",result.metahash);// BLAKE3 hash
import{gen_meta_code_v0}from"@iscc/lib";constiscc=gen_meta_code_v0("The Neverending Story","A novel by Michael Ende",);console.log(iscc);// "ISCC:AAA..."
importio.iscc.iscc_lib.IsccLib;Stringiscc=IsccLib.genMetaCodeV0("The Neverending Story","A novel by Michael Ende",null,64);System.out.println(iscc);// "ISCC:AAA..."
desc:="A novel by Michael Ende"result,_:=iscc.GenMetaCodeV0("The Neverending Story",&desc,nil,64,)fmt.Println(result.Iscc)// "ISCC:AAA..."
import{gen_meta_code_v0}from"@iscc/wasm";constiscc=gen_meta_code_v0("The Neverending Story","A novel by Michael Ende",);console.log(iscc);// "ISCC:AAA..."
JSON serialization (Python)
The Python result object supports both attribute access (result.iscc) and dict-style access
(result["iscc"]). It is also JSON-serializable:
Every ISCC code encodes its type, subtype, version, and length in a self-describing header. Use
iscc_decompose to inspect the components of a composite code:
fromiscc_libimportgen_meta_code_v0,iscc_decomposeresult=gen_meta_code_v0("The Neverending Story")units=iscc_decompose(result.iscc)print(units)# List of individual ISCC-UNIT strings
fromiscc_libimportgen_text_code_v0result=gen_text_code_v0("Hello World")print(result.iscc)# "ISCC:EAA..."print(result.characters)# Number of characters processed
fromiscc_libimportgen_instance_code_v0result=gen_instance_code_v0(b"Hello World")print(result.iscc)# "ISCC:IAA..."print(result.datahash)# Multihash of the dataprint(result.filesize)# Size in bytes
useiscc_lib::gen_instance_code_v0;letresult=gen_instance_code_v0(b"Hello World",64)?;println!("{}",result.iscc);// "ISCC:IAA..."println!("{}",result.datahash);// Multihashprintln!("{}",result.filesize);// Size in bytes
import{InstanceHasher}from"@iscc/wasm";consthasher=newInstanceHasher();// Feed Uint8Array chunks from a ReadableStream or Filehasher.update(newUint8Array([72,101,108,108,111]));hasher.update(newUint8Array([32,87,111,114,108,100]));console.log(hasher.finalize());