Skip to content

Instantly share code, notes, and snippets.

@suut
suut / 1_Blake2s.md
Last active May 1, 2026 17:24
JavaCard implementation of Blake2s
  • The card needs to have int support
  • The card needs to support the javacardx.framework.util.intx package
  • The input message is 32 bytes
  • The key is 32 bytes
  • The output message is 32 bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###########################################################################
# This is free and unencumbered software released into the public domain. #
# #
# Anyone is free to copy, modify, publish, use, compile, sell, or #
# distribute this software, either in source code form or as a compiled #
# binary, for any purpose, commercial or non-commercial, and by any #
# means. #
{% extends "base.html" %}
{% block body %}
<h1>{{ icon('shopping-cart') }} Produits</h1>
<dl class="sub-nav">
<dd class="active"><a href="/products/view">{{ icon('info') }} lister</a></dd>
<dd><a href="/products/add">{{ icon('fi-plus') }} ajouter</a></dd>
</dl>
<hr />
<div class="panel radius">
def split(txt, target):
# split according to \n in text
# split in 512 bytes (and be careful not to split in the middle of a UTF-8 control code)
final_text = []
for i in txt.split('\n'):
if len(i.encode())+11+len(target) >= 512:
s = i.encode()
splitted = []
cursor = 512-11-len(target)
while ''.join(j.decode() for j in splitted) != i:
#!/usr/bin/python3.3
#!/usr/bin/python3.3
# -*- coding: utf-8 -*-
from functions_core import Function
from core import ToSend
@Function('ping')
def ping(cmd, args, source, target):
return ToSend(target, 'pong')
#!/usr/bin/python3.3
# -*- coding: utf-8 -*-
# core.py
# Functions:
# [X] ToSend object
# [X] loading servers details
# [ ] loading servers config (in which is found username, etc.)
# [ ] logging to disk commands and status
# [ ] loading and providing configuration e.g. is_enabled()
# -*- coding: utf-8 -*-
# functions_core.py
# Elements:
# [X] IRC exceptions
# [X] sandbox function
# [X] function object
import core
[actions]
ciggin = {name} lights up a cigarette.;{names} are smokin cigs.
smokin = Puff puff! Another toke for {name};Puff puff! Another toke for {names}
trippin = {name} is seeing sounds and hearing colors.;{names} are trippin' balls!
poopin = {name} is poopin'.;{names} are poopin'.
jenkin = {name} is huffing that sweet sweet poo gas.;{names} are jenked up on jenkem!
snortin = {name} is insufflating all sorts of crazy shit into his or her nose!;{names} are doin' lines!
dexxin = {name} is sippin' that syrup.;{names} are sippin' that syrup.
nommin = {name} is a fatty!;{names} are fatties!
shootin = {name} is cookin up.;{names} are cookin up.
#include "Jacobi.hpp"
void Jacobi::fac2(uintmax_t n, uintmax_t &a, uintmax_t &b)
{
uintmax_t ret_a = 0;
uintmax_t ret_b = n;
while((ret_b&1) == 0)
{
ret_b = ret_b >> 1;
ret_a++;
@suut
suut / RSA.py
Last active August 29, 2015 13:56
#!/usr/bin/python3.3
# -*- coding: utf-8 -*-
import fractions, random
class RSA:
def __init__(self, p, q, b):
self.p = p
self.q = q
self.n = p*q