diff options
Diffstat (limited to 'doc/classes/HashingContext.xml')
-rw-r--r-- | doc/classes/HashingContext.xml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index 6e3092e618..7c2be6f817 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -11,15 +11,14 @@ const CHUNK_SIZE = 102 func hash_file(path): - var ctx = HashingContext.new() - var file = File.new() - # Start a SHA-256 context. - ctx.start(HashingContext.HASH_SHA256) # Check that file exists. - if not file.file_exists(path): + if not FileAccess.file_exists(path): return + # Start a SHA-256 context. + var ctx = HashingContext.new() + ctx.start(HashingContext.HASH_SHA256) # Open the file to hash. - file.open(path, File.READ) + var file = FileAccess.open(path, FileAccess.READ) # Update the context after reading each chunk. while not file.eof_reached(): ctx.update(file.get_buffer(CHUNK_SIZE)) |