Android Question Can not make simple F5Steg sample work

warayTek

Member
Licensed User
I'm trying to understand how to use Informatix's F5Steg lib work. I have an image with a secret message(I use python's library stepic to encode), I want B4a to decode the message. But I seem not able to trigger the event "Test", the image "dogTwo.png" is in File.DirAssets.
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private AppFolder As String = "KeepImage"
    Private AppFolderpath As String
    
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Dim F5S As F5Steg
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    CreateAppFolder
End Sub

Sub Activity_Resume
    If Not(File.Exists(File.DirDefaultExternal, "dogTwo.png")) Then
        File.Copy(File.DirAssets, "dogTwo.png", File.DirInternal, "dogTwo.png")
    End If

    F5S.ExtractToString(File.Combine(File.DirInternal , "dogTwo1.png"),"Test")

End Sub

Sub Test_StringExtracted(SecretMessage As String)
    Log("Here")
    Log("SecretMessage = " & SecretMessage)

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub CreateAppFolder
    If File.IsDirectory( File.DirInternal, AppFolder) = False Then
        File.MakeDir( File.DirInternal, AppFolder )
        Log("Folder Created!")
        AppFolderpath = File.DirInternal & "/" & AppFolder
        Log(AppFolderpath)
    Else
        Log("Folder Exist!")
        AppFolderpath = File.DirInternal & "/" & AppFolder
        Log(AppFolderpath)
    End If
    
    
'        If File.Exists( File.DirAssets,"somefile.txt" ) = True Then
'            File.Copy( File.DirAssets, "somefile.txt", AppFolder, "somefile.txt" )
'        End If
End Sub
 

warayTek

Member
Licensed User
@MikeSW17 I change a my code a bit so that I can understand it little more. But unfortunately I have no success yet.
B4X:
Sub btntest_Click
    Log("test here")
    LogColor("Copying dogImage ---------------->", Colors.Yellow)
    If Not(File.Exists(File.DirInternalCache, "dogTwo.jpg")) Then
        File.Copy(File.DirAssets, "dogTwo.png", File.DirInternalCache, "dogTwo.jpg")
        Log("Done copying")
        
    Else
        Log("File exist!")
    End If
    EmbedInImages2
End Sub


Sub EmbedInImages2
    'Encrypts and hides the password in the images
    LogColor("Processing dogTwo.jpg ---------->", Colors.Red)
    tb = DateTime.Now
    F5S.ExtractToString2(File.Combine(File.DirInternalCache , "dogTwo.jpg"), PASSWORD, "Informatix2")
End Sub


Sub Informatix2_StringExtracted(SecretMessage As String)
    'Checks if the password and the extracted string match
    Log("SECRET = " & SecretMessage)
    
    TheEnd = True
End Sub

As I understand the step process
File.Copy(File.DirAssets, "dogTwo.png", File.DirInternalCache, "dogTwo.jpg")
1. It requires the source image to be copied in the File.DirInternalCache with filename and extension in jpg.
F5S.ExtractToString2(File.Combine(File.DirInternalCache , "dogTwo.jpg"), PASSWORD, "Informatix2")
2. F5S.ExtractToString2 should extract the hidden message with three parameters and triggers the event Informatix2.
I leave PASSWORD variable to empty.

I still not able to call the Informatix2 event. Can you help point out what I'm doing wrong?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…