{"id":1561,"date":"2020-09-10T15:09:18","date_gmt":"2020-09-10T18:09:18","guid":{"rendered":"https:\/\/kondado.com.br\/blog\/wiki\/?p=1561"},"modified":"2026-04-08T17:49:09","modified_gmt":"2026-04-08T20:49:09","slug":"funcao-hash-sha-512-com-chave","status":"publish","type":"post","link":"https:\/\/kondado.com.br\/blog\/wiki\/2020\/09\/10\/funcao-hash-sha-512-com-chave\/","title":{"rendered":"Hash SHA-512 com chave"},"content":{"rendered":"\n<p><strong>Descri\u00e7\u00e3o<\/strong><\/p>\n\n\n\n<p>Aplica um hash SHA-512 ao campo concatenado com uma chave<\/p>\n\n\n\n<p><strong>Categoria<\/strong><\/p>\n\n\n\n<p>Pseudonimiza\u00e7\u00e3o<\/p>\n\n\n\n<p><strong>Tipos de campo suportados<\/strong><\/p>\n\n\n\n<ul><li>text<\/li><li>timestamp<\/li><li>date<\/li><li>float<\/li><li>int<\/li><li>boolean<\/li><li>time<\/li><\/ul>\n\n\n\n<p><strong>Tipo de sa\u00edda<\/strong> <strong>do campo<\/strong><\/p>\n\n\n\n<p>text<\/p>\n\n\n\n<p><strong>Argumentos<\/strong><\/p>\n\n\n\n<ul><li><em>Chave<\/em>: <a href=\"https:\/\/kondado.com.br\/blog\/wiki\/2020\/09\/10\/gerenciamento-de-chaves\/\">chave<\/a> que ser\u00e1 concatenada com o valor do campo original para passar pelo hash<\/li><\/ul>\n\n\n\n<p><strong>Pseudo-c\u00f3digo (python)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def func(val, key):\n    \"\"\"\n        val: campo\n        key: texto da chave\n    \"\"\"\n    import hashlib\n    if val:\n        sha = hashlib.sha512()\n        data=\"%s%s\" % (key, val)\n        sha.update(data.encode('utf-8'))\n        return sha.hexdigest()\n    else:\n        return None<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Documenta\u00e7\u00e3o da fun\u00e7\u00e3o HASH_SHA_512 da Kondado. Gere hashes criptogr\u00e1ficos SHA-512 com chave nos seus modelos de dados.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,448],"tags":[324,320,325,327],"_links":{"self":[{"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/posts\/1561"}],"collection":[{"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/comments?post=1561"}],"version-history":[{"count":8,"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/posts\/1561\/revisions"}],"predecessor-version":[{"id":11144,"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/posts\/1561\/revisions\/11144"}],"wp:attachment":[{"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/media?parent=1561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/categories?post=1561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kondado.com.br\/blog\/wiki\/wp-json\/wp\/v2\/tags?post=1561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}