mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
Currently including `zh_CN` and `es` which both have very high completion ratios. Others will be added once they reach a significant percentage too. These RST files will be used by godot-docs in place of its `classes` folder after we sync with https://github.com/godotengine/godot-docs/pull/5458. The update workflow is manual for now (example for `zh_CN`): - Build `godotengine/godot` in the branch we currently track (now `3.x`) - Run `godot --doctool -l zh_CN` - Run `cd doc && make rst LANGARG=zh_CN` - Copy `doc/_build/rst/*` to `classes/zh_CN/` here - Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
105 lines
4.3 KiB
ReStructuredText
105 lines
4.3 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the HashingContext.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_HashingContext:
|
|
|
|
HashingContext
|
|
==============
|
|
|
|
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
|
|
|
Contexto para calcular los hashes criptográficos en múltiples iteraciones.
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
La clase HashingContext proporciona una interfaz para computar hashes criptográficos en múltiples iteraciones. Esto es útil, por ejemplo, cuando se calculan hashes de archivos grandes (para no tener que cargarlos todos en la memoria), flujos de red y flujos de datos en general (para no tener que mantener búferes).
|
|
|
|
El :ref:`HashType<enum_HashingContext_HashType>` enum muestra los algoritmos de hash soportados.
|
|
|
|
::
|
|
|
|
const TAMANO_PORCION = 1024
|
|
|
|
func hash_archivo(ruta):
|
|
var contexto = HashingContext.new()
|
|
var archivo = File.new()
|
|
# Empieza un contexto SHA-256
|
|
contexto.start(HashingContext.HASH_SHA256)
|
|
# Comprueba que el archivo existe.
|
|
if not archivo.file_exists(ruta):
|
|
return
|
|
# Abre el archivo a hashear.
|
|
archivo.open(ruta, File.READ)
|
|
# Actualiza el contexto despues de leer cada porción.
|
|
while not archivo.eof_reached():
|
|
contexto.update(file.get_buffer(TAMANO_PORCION))
|
|
# Obtiene el hash computado.
|
|
var resultado = contexto.finish()
|
|
# Imprime el resultado como una string hexadecimal y array.
|
|
printt(resultado.hex_encode(), Array(resultado))
|
|
|
|
\ **Nota:** No disponible para exportar HTML5.
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolByteArray<class_PoolByteArray>` | :ref:`finish<class_HashingContext_method_finish>` **(** **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`start<class_HashingContext_method_start>` **(** :ref:`HashType<enum_HashingContext_HashType>` type **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`update<class_HashingContext_method_update>` **(** :ref:`PoolByteArray<class_PoolByteArray>` chunk **)** |
|
|
+-------------------------------------------+----------------------------------------------------------------------------------------------------------------+
|
|
|
|
Enumeraciones
|
|
--------------------------
|
|
|
|
.. _enum_HashingContext_HashType:
|
|
|
|
.. _class_HashingContext_constant_HASH_MD5:
|
|
|
|
.. _class_HashingContext_constant_HASH_SHA1:
|
|
|
|
.. _class_HashingContext_constant_HASH_SHA256:
|
|
|
|
enum **HashType**:
|
|
|
|
- **HASH_MD5** = **0** --- Algoritmo de Hasheado: MD5.
|
|
|
|
- **HASH_SHA1** = **1** --- Algoritmo de Hasheado: SHA-1.
|
|
|
|
- **HASH_SHA256** = **2** --- Algoritmo de Hasheado: SHA-256.
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_HashingContext_method_finish:
|
|
|
|
- :ref:`PoolByteArray<class_PoolByteArray>` **finish** **(** **)**
|
|
|
|
Cierra el contexto actual, y devuelve el hash calculado.
|
|
|
|
----
|
|
|
|
.. _class_HashingContext_method_start:
|
|
|
|
- :ref:`Error<enum_@GlobalScope_Error>` **start** **(** :ref:`HashType<enum_HashingContext_HashType>` type **)**
|
|
|
|
Inicia un nuevo cálculo de hash del ``tipo`` dado (por ejemplo, :ref:`HASH_SHA256<class_HashingContext_constant_HASH_SHA256>` para iniciar el cálculo de un SHA-256).
|
|
|
|
----
|
|
|
|
.. _class_HashingContext_method_update:
|
|
|
|
- :ref:`Error<enum_@GlobalScope_Error>` **update** **(** :ref:`PoolByteArray<class_PoolByteArray>` chunk **)**
|
|
|
|
Actualiza el cálculo con el ``chunk`` de datos dado.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|