Hash (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.0, 2.2-dev32 (SHA-256 algorithm)

Syntax

%strings% hash[ed] with (MD5|SHA-256)

Description

Hashes the given text using the MD5 or SHA-256 algorithms. Each algorithm is suitable for different use cases.<p> MD5 is provided mostly for backwards compatibility, as it is outdated and not secure. SHA-256 is more secure, and can used to hash somewhat confidental data like IP addresses and even passwords. It is not <i>that</i> secure out of the box, so please consider using salt when dealing with passwords! When hashing data, you <strong>must</strong> specify algorithms that will be used for security reasons! <p>Please note that a hash cannot be reversed under normal circumstanses. You will not be able to get original value from a hash with Skript.

Examples

command /setpass &lt;text&gt;:
	trigger:
		set {password::%uuid of player%} to text-argument hashed with SHA-256
command /login &lt;text&gt;:
	trigger:
		if text-argument hashed with SHA-256 is {password::%uuid of player%}:
			message "Login successful."
		else:
			message "Wrong password!"

View source