Android Question Protect database without sqlcipher

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Hi.
If i use sqlcipher in my project therefore add 3mb size to file
my output project shouldn't above 2 mb
is there any way to protect database without increase size of file?
 

MaFu

Well-Known Member
Licensed User
Longtime User
The standard sqlite database has no encryption.
You can encrypt yourself the data on insert and decrypt on read. But in this case you cannot use WHERE in SELECT statements because the database engine cannot read the real data.
 
Upvote 0

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
I'm not familiar with any such issue.
I found solution if it is working.
I read .db file accroding to byte and save it in random access file with password
and when i want to use bank then read byte from file and write it and use
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
Why? Can you not write: "SELECT * FROM MyTable WHERE MyField = " & MyEncryptionFunction(MyValue)

?
You're right, this may work. But it fails on "ORDER BY".
 
Upvote 0

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
You're right, this may work. But it fails on "ORDER BY".
For order by we can add field to database and extract startwith string and insert into related field
Example if i insert "Hello" => "asd2#E!@QDsd",also insert H character in field and
When i want to use order by,we can use Order By sStartWithField DESC

example table :
Name ID Phone sStartWidth Name ID Phone sStartWidth
asd@#asd @#asDD2 @#SDASDqd E => Erel 1 213123 E
DASd2!#!@ SFSDFSDf23 @#!QDQD!@ O => Omid 2 124123 O

Maybe?
 
Upvote 0

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
<----- I don't understand :)
:)
Ok
again explain
We use order by in sql for sort us record.
"Order by" always return result with startwith string generally
we can save startwith string example save "E" from "Erel" in field and when execute query use ORDER BY FieldName DESC
now what is FieldName above?
FieldName is field that we add to table for save startwith string example save "E" in field:rolleyes:
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
For order by we can add field to database and extract startwith string and insert into related field
Example if i insert "Hello" => "asd2#E!@QDsd",also insert H character in field and
When i want to use order by,we can use Order By sStartWithField DESC

example table :
Name ID Phone sStartWidth Name ID Phone sStartWidth
asd@#asd @#asDD2 @#SDASDqd E => Erel 1 213123 E
DASd2!#!@ SFSDFSDf23 @#!QDQD!@ O => Omid 2 124123 O

Maybe?
But if your strings differ after the first character?
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
this solution is for first character o_O
I know. But in case of names you will have many entries with same first character (and also often same second and third character).
 
Upvote 0
Top