yashsingh1/xdaforums huggingface dataset:
[XPERIA X10 Android Development] MrHassell:
http://www.linkpdf.com/ebook-viewer.php?url=http://wan.khudri.com/my_files/icici2005/paper_ICICI_2005.pdf - Matlab / same deal..

Stas Fomin - made a Mathmatica 2.2 function to share for download from his homepage :) Diggin the design :P http://www.oocities.org/stas_fomin/math.htm

Find signature by Elgamal signature scheme for plain text message P=823 with public key (p,r,b)=(2657,3,801), private key a=211, and where the integer k=101 is selected to construct the signature. Show how the signature is verified.

Signature: (m,n) where

m = r^k mod p

= 3^101 mod 2657

= 2022 mod 2657

n = k^(-1) (P - am) mod (p-1)

= 101^(-1) * (823 - 211 * 2022) mod 2656

= 973 * 1797 mod 2656, via 973 * 101 - 37 * 2656 = 1.

= 833 mod 2656.

Verification: Show that b^m * m^n = r^P mod p.

Compute

b^m * m^n = 801^2022 * 2022^833 mod 2657

2157 * 228 = 1014 mod 2657.

r^P = 3^823 mod 2657

= 1014 mod 2657

UNIVERSITY OF RUHUNA - DEPARTMENT OF MATHEMATICS

Bachelor of Science (General) Degree (Level III)

Applied Mathematics / Industrial Mathematics

MAM 3213: Applied Algebra (Coding Theory)

Lab Assignment No: 08

ElGamal Scheme

Discrete Logarithm problem

Given p, g, and y, the discrete logarithm problem is to ﬁnd x such that g x = y mod p, or

written another way, calculate x = logg,p y. It is easy to compute y from p, g, and x, but no

eﬃcient way of calculating x from p, g, and y is known.

The naive way to calculate the discrete logarithm is simply to calculate g, g 2 , g 3 , . . . until

y is found.

This is ineﬃcient since the time taken is proportional to p.

1. Implement a function to ﬁnd a, given ax mod p.

The baby-step / giant-step algorithm

An improvement over the naive algorithm is to ﬁrst calculate y, y.g, y.g 2 , y.g 3 , . . . , y.g a , where √ 2

a = ⌈ p⌉, and put the values in a hash table.

Then calculate g a , g 2a , g 3a , . . . , g a , and look in the table for a collision. In the case of a collision, g i .y = g ja gives y = g ja−i . The time taken √ is proportional to p.

2. Implement this procedure using Mathematica.

3. Plot log x and discrete log functions for given n.

ElGamal Public Key scheme

Step 1. Global elements: p a large prime, g primitive root of p.

Step 2. Decryption key: x - private, calculate a ≡ g x mod p.

Publish (p, g, a). (User A)

Step 3. Encryption: s message, 0 < s < p. Choose y - private, 0 < y < p.

Compute b ≡ g y mod p.

c ≡ say mod p.

Send (b, c). (User B)

Step 4. Decryption: Compute bx mod p ≡ ay .

then s ≡ (ay )−1 c mod p. (User A)

4. Implement ElGamal scheme using Mathematica.
[XPERIA X10 Android Development] MrHassell:
Bin4ry, Goroh, Z, Sony_Ericsson_X10 = Legends!

The rat with the yello mask on is a classic! :) thank you so much for this! wow fantastic work
[XPERIA X10 Android Development] Bin4ry:
Version 03 Touchscreen working, started again from scratch.

Please test and work with me. :)

Regards

Bin4ry
[XPERIA X10 Android Development] break1:
Seems like u cracked the bootloader? :D
[XPERIA X10 Android Development] Asdoos:
i think it isn't cracket its only ignored
[XPERIA X10 Android Development] DooMLoRD:
i can help out if u guys need help with MATLAB...
[XPERIA X10 Android Development] qwer23:
Resulting in exactly the same --> custom ROMs. And if it's really true (god I hope it is ;)) I think he (and all that contributed) should get the reward that was promised for "cracking the bootloader".

btw. Bin4ry, since Touchscreen is working, can you already tell what works right now and what doesn't?

Cheers and a big f***ing thx to all of you!

qwer23
[XPERIA X10 Android Development] break1:
That means? :p
[XPERIA X10 Android Development] MrHassell:
2am -;0

...Please test and work with me...

log for Bin4ry - all working from a 2.1update1 - flips over > back to full load with no problem, everything works as it's just returned back to the underlying firmware... but it is great proof!

@Bin4ry - could it push to a menu > recovery to select firmware to load?
[XPERIA X10 Android Development] mad-murdock:
too bad my post a month back suggesting the same was ignored
[XPERIA X10 Android Development] Bin4ry:
VERY GOOD!

Thanks for testing. When does it reboot? On Which Rom are you testing? Which baseband?

Do you had radio working?

Regards
[XPERIA X10 Android Development] Bin4ry:
Haven't ignored it. Was investigating in that because you posted here. :D

I was just quite for a while, testing and doing some stuff, also still studying :D

Regards
[XPERIA X10 Android Development] MrHassell:
Band 2.1.54 - Build 2.1.A.0.435 - Radio working.. everything working. I'm going to do it again and pump back the complete log after commands issued via adb shell

$ su

# chmod 06755 run.sh

# ./run.sh

failed

failed

adb exits - tiny screen text - rat with the golden mask - xda developers - orange led - quickly to red led - quickly to blue(white) led and hangs there for a while.. blacks out, reboots back to original eclair build - all working;

EDIT: THIS time... I'll run the sh script via terminal with su and no usb attached.. one sec - Result... same - need to use donut?
[XPERIA X10 Android Development] Bin4ry:
does it really reboot or does it RUN eclair ? (it is intended to run eclair).

Plz check kernel in phone info , which one is it ? -Bin4ry one?

Regards
[XPERIA X10 Android Development] MrHassell:
2.6.29 SEMCUser@SEMCHost #1 stock - Rebooting - I flashed out to this stock Eclair just before you posted new build, I'll switch to your kernel and - which firmware?
[XPERIA X10 Android Development] Bin4ry:
thanks,

will check again, but it seems we are near to a solution.

Regards
[XPERIA X10 Android Development] Aeny:
Using usb adb:

C:\Users\Aeny\AppData\Local\Android\android-sdk\platform-tools>adb shell

# cd /data/local/tmp

cd /data/local/tmp

# ./run.sh

./run.sh

umount: can't umount /mnt/sdcard: Device or resource busy

umount: can't umount /cdrom: No such file or directory

umount: can't umount /data/DxDrm/fuse: Invalid argument

killall: DxDrmServerIpc: no process killed

-> tiny texy -> deformed tux -> XDA logo -> android_ logo -> freezes on android_ logo -> reboot (dies to soon to logcat)

Using Terminal emulator:

reboot when entering ./run.sh command

X10 | 2.3.3 | Baseband 2.0.52 | J's Cyanogenmod 7 RC2 v10a | latest kexec kit

I hope this is helpful :o

~Aeny

EDIT: when using Terminal Emulator and adb logcat I can see it do all kinda stuff (killing and starting in processes) but it hangs on

"cannot become context manager (Device or resource busy)" (logcat) and then the phone reboots.
[XPERIA X10 Android Development] Bin4ry:
Can you try to run it on chargemon script instead of xRec?

So that we can run it at the very beginning of boot process. Maybe this is a solution!

This should work in the chargemon script:

exec /data/local/tmp/run.sh

WARNING!

JUST TRY THIS IF YOU KNOW WHAT YOU ARE DOING !

Regards
[XPERIA X10 Android Development] MrHassell:
this is going to work - you are right - I switched firmware earlier getting carried away with chargemon haha - this is going to work I can see I need to load the firmware this side as your building - which should I load - or just do a kernel flash with the multitouch kernel - push the files back in.. so close! :D I feel bottle of Chartreuse about to take flight!
[XPERIA X10 Android Development] Bin4ry:
Okay please stop writing here chitchat, go in this thread for chatting:

http://xdaforums.com/showthread.php?goto=newpost&t=1001308

BTT:

Anyone tryed to run it from chargemon script instead of xRec like i wrote above?

I talked to jerp and we think that the BB-version is important, since i build the kernel on 450er sources.

So please test on the BB which was delivered with 450er kernel so that it can communicate with BB correctly.

Regards

Bin4ry
[XPERIA X10 Android Development] Androxyde:
chargemon the safer way :

Just before recovery if then else :

if [ -e /data/local/tmp/kexec ]

then

rm -r /data/local/tmp/kexec

exec /data/local/tmp/run.sh

fi

so from the OS, touch /data/local/tmp/kexec the reboot and it will boot the kexec script and remove the kexec file so that the next boot or reboot will go fine
[XPERIA X10 Android Development] -- X10B --:
all booted fine one wlod on first boot, i have radio and everything is working fine,, then reboot back to my current rom.. im on latest FW .16 BB .58

.....:p

qouted above is from binary
[XPERIA X10 Android Development] Bin4ry:
So, 2 users with bb58 had booted fine then WLOD.

Seems the initial idea is working :)

Now fix the problems and all is good ?

Regards
[XPERIA X10 Android Development] Flo95:
What's about baseband 2.1.54?
[XPERIA X10 Android Development] Bin4ry:
Give it a try and report.

Regards
[XPERIA X10 Android Development] Flo95:
Just check xda in short periods with my phone. I have to study Spain atm. I'm sorry :(
[XPERIA X10 Android Development] Bin4ry:
Need someone to test this in stock Rom with Baseband 2.1.54 -> 2.1.58

Attached boot.zip uncompress and push boot.img to phone run as before!

Regards

Bin4ry
[XPERIA X10 Android Development] DooMLoRD:
tested kexec_kit_bin4ry3 on ROM: FreeX10-beta4 | Baseband: 2.1.54 using the steps mentioned by Bin4ry & Androxyde (here) with the following chargemon file:

#!/system/recovery/sh

if [ -e /data/local/tmp/kexec ]
then
rm -r /data/local/tmp/kexec
exec /data/local/tmp/run.sh
fi

/system/bin/charger

DEVICE=`cat /system/recovery/model`

case $DEVICE in
X10*)
cat /dev/input/event2 > /dev/keycheck& ;;
E10*)
cat /dev/input/event1 > /dev/keycheck& ;;
U20*)
cat /dev/input/event0 > /dev/keycheck& ;;
E15*)
cat /dev/input/event1 > /dev/keycheck& ;;
esac

sleep 3
kill -9 $!

if [ -s /dev/keycheck -o -f /data/local/tmp/flashtool ]
then
rm -r /data/local/tmp/flashtool
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /cache
umount -l /data
# Mount recovery partition
rm -r /sbin
rm -r /etc
(cd /;tar -xjf /system/recovery/recovery.tar.bz2)
# Umount /system
umount -l /system
# chroot
chroot / /init
else
if test -f /system/bin/ramdisk.tar
then
# remount rw
mount -o remount,rw rootfs /
cd /
rm -r /sdcard
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar

if test -f /system/bin/chroot
then
# zdzihu: hack-fix for 2.2 roms
/system/bin/chroot / /init
else
# other roms 2.3/etc
chroot / /init
fi
fi
fi

# Continue booting
exit

on reboot saw SE text logo -> my usual bootanimation -> OS loaded -> got tons of FCs... android.acore process, messaging app, lots lots of others FCs... wasnt able to get radio (no coverage) but i guess that might be dude to FCs... couldnt check "About Phone"... upon reboot could safely get back to previous settings and radio was back, thank you Androxyde for the safe chargemon modification...

will flash FW 2.1.0.435 with bb 2.1.54 now... will report in a while
[XPERIA X10 Android Development] chiefy009:
Want anything tested on baseband 52? If so do I just push the file can I restore after?

Just trying to help delete if needs be
[XPERIA X10 Android Development] DooMLoRD:
will do...

just charging phone before flashing... (<15% battery left)

will report for baseband 2.1.54 with stock fw in some time
[XPERIA X10 Android Development] Bin4ry:
Chargemon for easy use:

#!/system/recovtools/sh

/system/bin/charger

DEVICE=`cat /system/build.prop|grep ro.build.product|grep X10`
if test -n "$DEVICE"
then
cat /dev/input/event2 > /dev/keycheck&
else
DEVICE=`cat /system/build.prop|grep ro.build.product|grep E10`
if test -n "$DEVICE"
then
cat /dev/input/event1 > /dev/keycheck&
else
DEVICE=`cat /system/build.prop|grep ro.build.product|grep U20`
if test -n "$DEVICE"
then
cat /dev/input/event0 > /dev/keycheck&
else
cat /dev/input/event1 > /dev/keycheck&
fi
fi
fi

sleep 3
kill -9 $!
if [ -e /data/local/tmp/kexec ]
then
rm -r /data/local/tmp/kexec
stop
stop servicemanager
stop vold
stop debuggerd
stop ril-daemon
stop installd
stop keystore
stop qmuxd
stop akmd2
stop media
stop dbus
stop port-bridge
stop wpa_supplicant
stop dhcpcd
umount /cache
umount /sdcard
umount /cdrom
umount /data/DxDrm/fuse
killall -9 DxDrmServerIpc
sleep 1
insmod /data/local/tmp/splboot.ko
sync
cat /data/local/tmp/miniloader > /proc/splboot/image
cat /data/local/tmp/boot.img > /proc/splboot/boot_img
sleep 5
echo > /proc/splboot/boot
fi
if [ -s /dev/keycheck -o -f /data/local/tmp/flashtool ]
then
rm -f /data/local/tmp/flashtool
# remount rootfs rw
mount -o remount,rw rootfs /

# Umount MTDs
umount -l /cache
umount -l /data

# Mount recovery partition
rm -r /sbin
rm -f /etc
(cd /;tar -xzf /system/recovtools/xrecovery.tar.gz)

# Umount /system
umount -l /system

# chroot
chroot / /init

fi

# Continue booting
exit

To run kexec just do this via adb:

touch /data/local/tmp/kexex

Then reboot.

Regards
[XPERIA X10 Android Development] Bin4ry:
All tests are Welcome!

Just post firmware version and baseband version with your results ! :)

No need to restore after! After reboot it reboots in normal image !

Regards
[XPERIA X10 Android Development] Asdoos:
Is this method compatible with other devices ? If not what must be change to make it work for example on x8
[XPERIA X10 Android Development] chiefy009:
Don't laugh. Where do I push the boot image to what file?

Or do I flash the zip through recovery....just want to help tell me to go away if you want. Using 2.2 wolf rom
[XPERIA X10 Android Development] DooMLoRD:
just an additional comment...

the following chargemon will work only for recovery flashed through Flashtool v0.2.8 for stock roms only

also please do not try that chargemon on CM7RC2 roms (u wont be able to get into the OS cause recovery on CM7RC2 is shifted to /system/recovery/

also the line chroot / /init will work for 2.3 roms but is not compatible with 2.2 roms... for 2.2 roms u need /system/bin/chroot / /init
[XPERIA X10 Android Development] RaDi:
i am on 52BB and CM7 and i can test any thing !

also i can chang rom or BB if you want !

just tell me what do you want bina4y and i will do it .

and how to flash boot.img
[XPERIA X10 Android Development] pato66:
What do you want?, I have a bb54
[XPERIA X10 Android Development] -- X10B --:
boot.img installed >> boots normal got my radio, wifi , everything works fine...

FW : 2.1.1.A.0.16

BB : 2.1.58

test ok......
[XPERIA X10 Android Development] The Gingerbread Man:
I'm willing to help test. I'm using bb.52 cm7 v10a. I tried flashing it with recovery but nothing has changed? How do we load this little beauty of a file?
[XPERIA X10 Android Development] DooMLoRD:
i dont want to offend anyone but here is a universal chargemon file which i was working on (with the help of Androxyde) for the last few days... it has the chargemon modification which was mentioned by Androxyde here and by Bin4ry here

#!/system/recovery/sh

/system/bin/charger

DEVICE=`cat /system/recovery/model`

case $DEVICE in
X10*)
cat /dev/input/event2 > /dev/keycheck& ;;
E10*)
cat /dev/input/event1 > /dev/keycheck& ;;
U20*)
cat /dev/input/event0 > /dev/keycheck& ;;
E15*)
cat /dev/input/event1 > /dev/keycheck& ;;
esac

sleep 3
kill -9 $!

if [ -e /data/local/tmp/kexec ]
then
rm -r /data/local/tmp/kexec
stop
stop servicemanager
stop vold
stop debuggerd
stop ril-daemon
stop installd
stop keystore
stop qmuxd
stop akmd2
stop media
stop dbus
stop port-bridge
stop wpa_supplicant
stop dhcpcd
umount /cache
umount /sdcard
umount /cdrom
umount /data/DxDrm/fuse
killall -9 DxDrmServerIpc
sleep 1
insmod /data/local/tmp/splboot.ko
sync
cat /data/local/tmp/miniloader > /proc/splboot/image
cat /data/local/tmp/boot.img > /proc/splboot/boot_img
sleep 5
echo > /proc/splboot/boot
fi

if [ -s /dev/keycheck -o -f /data/local/tmp/flashtool ]
then
rm -r /data/local/tmp/flashtool
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /cache
umount -l /data
# Mount recovery partition
rm -r /sbin
rm -r /etc
(cd /;tar -xjf /system/recovery/recovery.tar.bz2)
# Umount /system
umount -l /system
# chroot
chroot / /init
else
if test -f /system/bin/ramdisk.tar
then
# remount rw
mount -o remount,rw rootfs /
cd /
rm -r /sdcard
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar

if test -f /system/bin/chroot
then
# zdzihu: hack-fix for 2.2 roms
/system/bin/chroot / /init
else
# other roms 2.3/etc
chroot / /init
fi
fi
fi

# Continue booting
exit

use this ONLY after u have used FlashTool beta v0.2.9 to reinstall xRecovery on the rom u using custom/stock... additionally do not REBOOT after installing recovery immediately unless u HAVE made the above changes to chargemon file and made sure the permissions of the chargemon file are as follows

chmod 755 /system/bin/chargemon

trust me it will save u a lot of headache and avoid issues like stuck at SE text logo...
[XPERIA X10 Android Development] Bwyan Benton:
I think it was stated that you have to use stock 2.1 to test it. I could have read that wrong tho.
[XPERIA X10 Android Development] pato66:
The same for me, with SE 2.1.1.0.435 BB54, after reboot, my x10 dont change, all is normal.

Im flashed with kexec_kit_bin4ry3.zip

Cheers
[XPERIA X10 Android Development] wolfilein:
@all

you shouldn't flash the file with xrecovery!

you should extract it to

/data/local/tmp/

on you phone

and replace the /system/bin/chargemon with the one bin4ry has posted some posts ago

after that make it executable

with

chmod 755 /system/bin/chargemon

then create the file /data/local/tmp/kexec

with

touch /data/local/tmp/kexec

and then reboot you phone should load the new kernel
[XPERIA X10 Android Development] DooMLoRD:
actually the file /data/local/tmp/flashtool lets u boot into recovery from flashtool (0.2.8+)

for testing out this new boot.img u need to create the file /data/local/tmp/kexec

with

touch /data/local/tmp/kexec
[XPERIA X10 Android Development] PoTi_96:
can you explain it step for step plz?

sould i copy the folder bootkit to /data/local/tmp or scr too?

then

adb shell
$ su
# chmod 06755 run.sh
# ./run.sh

like bin4ry wrote inhis bootkit folder (howto)

what do i have to do then?
[XPERIA X10 Android Development] jimbo77:
Guys Please don't spam the dev Thread... If you are going to test it just do it and then post the results. They've written the instructions very clear, do not use XRECOVERY it will not do anything.

Mods please clean the thread including this post.

Jim
[XPERIA X10 Android Development] RaDi:
BB :52

Se 2.1 FW

itry it then it boot fine but no signal ! i try to reboot the phone but i got same !
[XPERIA X10 Android Development] RaDi:
trying to check it out agein but with BB54 SE 2.1 ............
[XPERIA X10 Android Development] jerpelea:
cm7 boots with custom kernel
[XPERIA X10 Android Development] DooMLoRD:
test with Stock SE ROM FW: 2.1.A.0.435 | BB: 2.1.54

booted into OS but no radio, strange question mark symbol on top of battery symbol (in notification bar)... phone rebooted in few seconds couldnt get into "About Phone"... though no LED notifications of any sort... even have made a video of boot up process [it look good on handset ;) ] will post it here in a while

EDIT:

on second attempt tried to get to "About Phone" asap... under "Kernel Version" it was "unknown"... and then the system immediately rebooted...

keep up the great work Bin4ry and all other devs...
[XPERIA X10 Android Development] Asdoos:
Can you make it for X8 twice?
[XPERIA X10 Android Development] XperianPro:
X8 have everything same but we need our boot.img to test is it working if not it will be good if bin4ry can you get few minutes just to make little modify for X8.

Im saying thin in name of all xperia users.

Thanks.
[XPERIA X10 Android Development] DooMLoRD:
and here is the video of the bootup process

this is with Stock SE FW 2.1.A.0.435 & Baseband 2.1.54

here is the video of the bootup process with files from "kexec_kit_bin4ry3.zip" and boot.img from here

http://www.mediafire.com/?7f1xcj7911jxgyn

also tested with boot.img from "kexec_kit_bin4ry3.zip" same result... phone reboots within a few seconds and in "About Phone" the "Kernel Version" shows as "Unknown"
[XPERIA X10 Android Development] DooMLoRD:
just a thought...

i think we can speed up the process of testing...

we flash one of the stock SE FW... the we can quickly keep changing basebands packages with the baseband collection by rendeiro2005 and try testing the FW with various basebands...

what say?

i am doing this right now with Stock FW 2.1.A.0.435 and various basebands packages...
[XPERIA X10 Android Development] Androxyde:
I am on stock firmware A.0.16

I modded my chargemon to implement booting cust kernels from it and a gscript script shortcut on the desktop to reboot.

I tried these :

Reboot custom kernel with stock BB .58 : booted / no radio / reboot in less than 1 minute

Reboot custom kernel with BB 55 : same as with .58

Reboot custom kernel with BB 52 : booted / no radio / no reboot

Reboot stock rom with BB 52 : no radio

So with my last try I cannot conclude anything about the "no radio"

Will keep you informed with my further tests
[XPERIA X10 Android Development] Androxyde:
Dunno if it can help but I compared the checksum of each files from BB to BB versions :

amss_fs and cache is exactly the same in BB 52, 55, 58

dsp1 is the same in BB 55 and 58 and a different one in BB 52

all other files differs from BB 52, 55, 58 (amss, fota0, fota1, kernel)
[XPERIA X10 Android Development] HunteronX:
Thanks DooMLoRD. :)

Using this on Wolfbreak's 2.2 rom, I created a script with GScript (thanks to Androxyde):

"touch /data/local/tmp/kexec"

I then rebooted my phone and the boot image was loaded. But after about 10 seconds of the phone being fully loaded, the phone crashed and rebooted.

EDIT: Is this due to incompatibilities with the kernel, or has this been happening on 2.1 firmwares also?

My baseband is .58
[XPERIA X10 Android Development] Aeny:
Using latest boot.img | J's CM7 RC2 V10a | BB .52

After the screen switches off once it will refuse to turn on. I started the music app before this happened and it keeps playing happily, Volume up/down keys respond. Also the 2LED lights come on when pressing any button but they don't wake up the screen. logcats keeps "-waiting for device-" I hope this is useful for future kernel development ;)

~Aeny
[XPERIA X10 Android Development] Bin4ry:
Thanks for all the testing.

I have exam on wednesday so i won't work tomorrow on this, because i have to learn some more math :P

I attach the kernel patches,my kernel config and the build script from zdzihu.

Maybe someone else is willing to give it a try :)

Best Regards

Bin4ry
[XPERIA X10 Android Development] goroh_kun:
hi, in fact bootloader is not needed after bootup linux kernel,

so I can't say possible to find spl in physical memory( I mean in internel RAM).

but I think you can use this module for other armv7 platfrom normally.

if you want port this module for armv6, you can modify codes,

and you can run fastboot.