Skip to content

Instantly share code, notes, and snippets.

View sebastianknopf's full-sized avatar

Sebastian Knopf sebastianknopf

View GitHub Profile
@DimazzzZ
DimazzzZ / iso-639-1-codes.php
Last active April 27, 2024 04:34 — forked from ddebin/iso_array_lang.php
ISO 639-1 language codes array
<?php
$codes = [
'ab' => 'Abkhazian',
'aa' => 'Afar',
'af' => 'Afrikaans',
'ak' => 'Akan',
'sq' => 'Albanian',
'am' => 'Amharic',
'ar' => 'Arabic',
@spiritinlife
spiritinlife / HMAC.java
Created November 27, 2014 18:50
HMAC RETROFIT ANDROID
import android.util.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
public class HMAC {
public static String hmacDigest(String msg, String keyString, String algo) {
@turret-io
turret-io / verify_hmac.php
Last active April 10, 2023 17:45
Verify HMAC in PHP
<?php
define("SHARED_SECRET", "sup3rs3cr3t!!");
if(!function_exists('hash_equals')) {
function hash_equals($str1, $str2) {
// Run constant-time comparison for PHP < 5.6 which doesn't support hmac_equals
$str1_len = strlen($str1);
$str2_len = strlen($str2);
@nojimage
nojimage / session_acl_component.php
Created January 14, 2011 11:12
CakePHP ACL Caching using Session
<?php
/**
* AclComponent using Session Cache for CakePHP 1.3
*
* Copyright 2011, nojimage (http://php-tips.com/)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*