Last active
October 24, 2018 03:15
-
-
Save eteeselink/4dc3ad32cc478986ff2b5b6361a1825f to your computer and use it in GitHub Desktop.
PHP implementation of TalkJS's `Talk.oneOnOneId` function
This file contains 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 | |
function oneOnOneId(string $meId, string $otherId) { | |
$ids = [$meId, $otherId]; | |
sort($ids, SORT_STRING); | |
return substr(sha1(json_encode($ids)), 0, 20); | |
} | |
echo oneOnOneId("aa", "bb"); // fd031b78f1add01539dc | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment