Skip to content

Instantly share code, notes, and snippets.

@shapr
Created December 12, 2022 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shapr/11e41ca59fb60f8dc98b3ff145932ef0 to your computer and use it in GitHub Desktop.
Save shapr/11e41ca59fb60f8dc98b3ff145932ef0 to your computer and use it in GitHub Desktop.
Inside Termux: apt install ghc, adb push Main.hs $(dest dir); ghc --make -package base Main.hs ; LD_PRELOAD=$PWD/libchallenge_bypass_ristretto_ffi.so ./Main
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import Foreign.C.String
import Foreign.Ptr
data C_Token
foreign import ccall "lib.h token_random" tokenRandom :: IO (Ptr C_Token)
foreign import ccall "lib.h token_encode_base64" tokenEncodeBase64 :: (Ptr C_Token) -> IO CString
main :: IO ()
main = do
tr <- tokenRandom
btr <- tokenEncodeBase64 tr
res <- peekCAString btr
print res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment