Skip to content

Instantly share code, notes, and snippets.

View pdlan's full-sized avatar

Dinglan Peng pdlan

  • IN, United States
View GitHub Profile
@pdlan
pdlan / hash.cc
Created January 19, 2022 17:51
compile time type hash
template <typename T>
constexpr uint64_t type_hash() {
const char *name = __PRETTY_FUNCTION__;
size_t len;
for (len = 0; name[len]; len++);
const uint64_t m = 0xc6a4a7935bd1e995ull;
const int r = 47;
const uint64_t seed = 0;
uint64_t h = seed ^ (len * m);
for (size_t j = 0; j < len / 8; ++j) {
@pdlan
pdlan / lightdm.conf
Last active February 22, 2020 10:24
LightDM with VNC (NOT INETD)
[Seat:*]
xserver-command=/etc/vlab/vncserver-lightdm
greeter-hide-users=false
greeter-setup-script=/etc/vlab/setup.sh
#allow-user-switching=true
@pdlan
pdlan / ra2nespec.md
Created January 2, 2020 21:07
RA2ne Security Type Specification

RA2ne Security Type Specification

ServerPublicKey

After RA2ne security type is selected server sends its RSA public key of 2048 bits. Note that the modulus and the public exponent are big-endian big integers.

No. of bytes Type Value Description
4 U32 2048 Key length in bits
256 U8 array Modulus (n)