Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.


Inherits: RefCounted < Object

Provides functionality for computing cryptographic hashes chunk by chunk.


The HashingContext class provides an interface for computing cryptographic hashes over multiple iterations. Useful for computing hashes of big files (so you don't have to load them all in memory), network streams, and data streams in general (so you don't have to hold buffers).

The HashType enum shows the supported hashing algorithms.

const CHUNK_SIZE = 1024

func hash_file(path):
    # Check that file exists.
    if not FileAccess.file_exists(path):
    # Start a SHA-256 context.
    var ctx =
    # Open the file to hash.
    var file =, FileAccess.READ)
    # Update the context after reading each chunk.
    while not file.eof_reached():
    # Get the computed hash.
    var res = ctx.finish()
    # Print the result as hex string and array.
    printt(res.hex_encode(), Array(res))