This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Valida um CNPJ com 14 caracteres, onde os 12 primeiros podem ser alfanuméricos e os 2 últimos são dígitos verificadores. | |
* A validação é feita utilizando o método do módulo 11, e para caracteres alfabéticos o valor ASCII é subtraído por 48. | |
* | |
* @link http://normas.receita.fazenda.gov.br/sijut2consulta/link.action?idAto=141102 | |
* @param string $cnpj O CNPJ a ser validado, com 14 caracteres alfanuméricos (12 primeiros) e numéricos (2 últimos). | |
* @return bool Retorna true se o CNPJ for válido, false caso contrário. | |
* @author Bruno Constantino | |
* @date 2024-10-29 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function heidiDecode(hex) { | |
var str = ''; | |
var shift = parseInt(hex.substr(-1)); | |
hex = hex.substr(0, hex.length - 1); | |
for (var i = 0; i < hex.length; i += 2) | |
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift); | |
return str; | |
} | |
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393')); |