Code prompts

Secure Image Vault Browser Tool

Encrypted local image vault browser in Python.

Example code

Python
import tkinter as tk
from tkinter import ttk, filedialog, messagebox
import cv2
import numpy as np
from PIL import Image, ImageTk, ImageDraw, ImageFilter
import os
import json
import hashlib
import base64
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
import threading
import time
import random

class DarkSensualImageVault:
    def __init__(self, root):
        self.root = root
        self.root.title("VelvetVault - Private Collection Guardian")
        self.root.geometry("1280x800")
        self.root.configure(bg="#0a0508")
        
        # Sensual dark theme colors
        self.bg_color = "#0a0508"
        self.accent_color = "#8a2a5e"  # Deep sensual rose
        self.glow_color = "#c44a7f"
        self.text_color = "#f0d0e0"
        self.soft_glow = "#4a1a32"
        
        self.collections = {}
        self.current_collection = None
        self.key = None
        self.fernet = None
        self.vault_path = os.path.expanduser("~/VelvetVault")
        os.makedirs(self.vault_path, exist_ok=True)
        
        self.setup_styles()
        self.create_interface()
        self.load_existing_collections()
        
        # Subtle animated sensual lighting effect
        self.lighting_phase = 0
        self.animate_lighting()
    
    def setup_styles(self):
        style = ttk.Style()
        style.theme_use("clam")
        
        style.configure("TFrame", background=self.bg_color)
        style.configure("TLabel", background=self.bg_color, foreground=self.text_color, font=("Helvetica", 11))
        style.configure("Header.TLabel", background=self.bg_color, foreground="#ff9ec8", font=("Helvetica", 24, "bold"))
        
        style.configure("TButton", background=self.accent_color, foreground="white", 
                       font=("Helvetica", 10, "bold"), padding=10, borderwidth=0)
        style.map("TButton", background=[("active", self.glow_color)])
        
        style.configure("Accent.TButton", background="#c44a7f", foreground="white", 
                       font=("Helvetica", 11, "bold"))
        
        style.configure("Treeview", background="#1a0f14", foreground=self.text_color, 
                       fieldbackground="#1a0f14", font=("Helvetica", 10))
        style.configure("Treeview.Heading", background=self.accent_color, foreground="white")
    
    def create_interface(self):
        # Main container with sensual shadow effect
        main_frame = ttk.Frame(self.root, style="TFrame")
        main_frame.pack(fill=tk.BOTH, expand=True, padx=20, pady=20)
        
        # Header with glowing title
        header = tk.Frame(main_frame, bg=self.bg_color)
        header.pack(fill=tk.X, pady=(0, 20))
        
        title = tk.Label(header, text="VELVETVAULT", font=("Helvetica", 32, "bold"),
                        fg=self.glow_color, bg=self.bg_color)
        title.pack(side=tk.LEFT)
        
        subtitle = tk.Label(header, text="private • sensual • secure", 
                           font=("Helvetica", 10), fg="#6b2a45", bg=self.bg_color)
        subtitle.pack(side=tk.LEFT, padx=(10, 0), pady=(12, 0))
        
        # Create glowing orb effect in header
        self.orb_canvas = tk.Canvas(header, width=60, height=60, bg=self.bg_color, 
                                   highlightthickness=0)
        self.orb_canvas.pack(side=tk.RIGHT)
        self.draw_sensual_orb()
        
        # Split pane
        paned = tk.PanedWindow(main_frame, orient=tk.HORIZONTAL, bg=self.bg_color, sashwidth=6)
        paned.pack(fill=tk.BOTH, expand=True)
        
        # Left sidebar - Collections
        left_frame = tk.Frame(paned, bg="#14090f", width=280, relief=tk.FLAT, bd=0)
        left_frame.pack_propagate(False)
        
        tk.Label(left_frame, text="YOUR COLLECTIONS", bg="#14090f", fg="#ff9ec8", 
                font=("Helvetica", 12, "bold")).pack(pady=(15, 5), padx=15, anchor="w")
        
        self.collection_list = tk.Listbox(left_frame, bg="#1f0f19", fg=self.text_color,
                                        selectbackground=self.accent_color, selectforeground="white",
                                        font=("Helvetica", 11), relief=tk.FLAT, bd=0, height=15)
        self.collection_list.pack(fill=tk.BOTH, expand=True, padx=15, pady=(0, 15))
        self.collection_list.bind('<<ListboxSelect>>', self.on_collection_select)
        
        btn_frame = tk.Frame(left_frame, bg="#14090f")
        btn_frame.pack(fill=tk.X, padx=15, pady=10)
        
        tk.Button(btn_frame, text="NEW COLLECTION", bg=self.accent_color, fg="white",
                 font=("Helvetica", 10, "bold"), relief=tk.FLAT, height=2,
                 command=self.create_new_collection).pack(fill=tk.X, pady=(0, 5))
        
        tk.Button(btn_frame, text="IMPORT IMAGES", bg="#3a1a2b", fg="#f0d0e0",
                 font=("Helvetica", 10, "bold"), relief=tk.FLAT, height=2,
                 command=self.import_images).pack(fill=tk.X)
        
        paned.add(left_frame, width=280)
        
        # Main viewing area
        self.main_area = tk.Frame(paned, bg=self.bg_color)
        paned.add(self.main_area, width=700)
        
        # Welcome / preview area with sensual overlay
        self.canvas = tk.Canvas(self.main_area, bg="#14090f", highlightthickness=2, 
                               highlightbackground=self.soft_glow)
        self.canvas.pack(fill=tk.BOTH, expand=True, padx=20, pady=20)
        
        self.welcome_text = self.canvas.create_text(400, 200, text="Select or create a collection\nto begin hiding your private treasures",
                                                   fill="#664455", font=("Helvetica", 14), justify=tk.CENTER)
        
        # Bottom toolbar
        toolbar = tk.Frame(self.main_area, bg="#14090f", height=70)
        toolbar.pack(fill=tk.X, padx=20, pady=(0, 20))
        
        tk.Button(toolbar, text="ENCRYPT & HIDE", bg="#8a2a5e", fg="white", width=18, height=3,
                 font=("Helvetica", 11, "bold"), command=self.encrypt_current_collection).pack(side=tk.LEFT, padx=8)
        
        tk.Button(toolbar, text="DECRYPT & REVEAL", bg="#3a1a2b", fg="#f0d0e0", width=18, height=3,
                 font=("Helvetica", 11, "bold"), command=self.decrypt_current_collection).pack(side=tk.LEFT, padx=8)
        
        tk.Button(toolbar, text="ADD TO COLLECTION", bg="#2a1a22", fg="#e0b0c8", width=18, height=3,
                 font=("Helvetica", 11, "bold"), command=self.add_images_to_current).pack(side=tk.LEFT, padx=8)
        
        # Right panel - Image grid / metadata
        right_frame = tk.Frame(paned, bg="#14090f", width=280, relief=tk.FLAT)
        right_frame.pack_propagate(False)
        
        tk.Label(right_frame, text="COLLECTION CONTENTS", bg="#14090f", fg="#ff9ec8", 
                font=("Helvetica", 12, "bold")).pack(pady=(15, 5), padx=15, anchor="w")
        
        self.image_list = tk.Listbox(right_frame, bg="#1f0f19", fg=self.text_color,
                                    selectbackground=self.glow_color, font=("Helvetica", 10))
        self.image_list.pack(fill=tk.BOTH, expand=True, padx=15, pady=(0, 10))
        
        tk.Label(right_frame, text="SECURITY", bg="#14090f", fg="#9c6a7f", 
                font=("Helvetica", 10, "bold")).pack(pady=(15, 5), padx=15, anchor="w")
        
        self.status_label = tk.Label(right_frame, text="SECURE • ENCRYPTED • HIDDEN", 
                                    bg="#14090f", fg="#6b9c7a", font=("Helvetica", 9))
        self.status_label.pack(padx=15, anchor="w")
        
        paned.add(right_frame, width=280)
        
        # Status bar with sensual pulse
        self.status_bar = tk.Label(self.root, text="VelvetVault is watching over your secrets...", 
                                  bg="#0a0508", fg="#664455", font=("Helvetica", 9))
        self.status_bar.pack(fill=tk.X, side=tk.BOTTOM, ipady=4)
    
    def draw_sensual_orb(self):
        self.orb_canvas.delete("all")
        # Soft outer glow
        self.orb_canvas.create_oval(8, 8, 52, 52, fill="#3a1a2b", outline="")
        # Main orb with sensual gradient simulation
        self.orb_canvas.create_oval(15, 15, 45, 45, fill=self.glow_color, outline="#ff9ec8", width=3)
        # Inner highlight
        self.orb_canvas.create_oval(22, 20, 30, 27, fill="#ffe0ee", outline="")
    
    def animate_lighting(self):
        self.lighting_phase += 0.08
        intensity = 0.5 + 0.5 * np.sin(self.lighting_phase)
        
        r = int(138 + 40 * intensity)
        g = int(42 + 25 * intensity)
        b = int(94 + 35 * intensity)
        
        new_color = f"#{r:02x}{g:02x}{b:02x}"
        self.glow_color = new_color
        
        # Update orb subtly
        if hasattr(self, 'orb_canvas'):
            self.draw_sensual_orb()
        
        self.root.after(80, self.animate_lighting)
    
    def load_existing_collections(self):
        self.collection_list.delete(0, tk.END)
        for item in os.listdir(self.vault_path):
            if item.endswith(".vvault"):
                name = item[:-7]
                self.collection_list.insert(tk.END, name)
                self.collections[name] = {"path": os.path.join(self.vault_path, item), "images": []}
    
    def create_new_collection(self):
        name = tk.simpledialog.askstring("New Private Collection", "Name your intimate collection:", 
                                       parent=self.root)
        if not name:
            return
        
        name = name.strip().replace(" ", "_")
        if name in self.collections:
            messagebox.showwarning("Exists", "Collection already exists")
            return
        
        vault_file = os.path.join(self.vault_path, f"{name}.vvault")
        self.collections[name] = {"path": vault_file, "images": [], "key": None}
        
        self.collection_list.insert(tk.END, name)
        self.collection_list.selection_clear(0, tk.END)
        self.collection_list.selection_set(tk.END)
        self.on_collection_select(None)
        
        self.status_bar.config(text=f"Created intimate collection: {name}")
    
    def on_collection_select(self, event):
        selection = self.collection_list.curselection()
        if not selection:
            return
        name = self.collection_list.get(selection[0])
        self.current_collection = name
        self.image_list.delete(0, tk.END)
        
        if self.collections[name].get("images"):
            for img_path in self.collections[name]["images"]:
                self.image_list.insert(tk.END, os.path.basename(img_path))
        
        self.canvas.delete("all")
        self.canvas.create_text(400, 180, text=f"COLLECTION: {name.upper()}", 
                               fill=self.glow_color, font=("Helvetica", 18, "bold"))
        self.canvas.create_text(400, 240, text="All images are encrypted at rest.\n"
                               "Your private collection remains hidden\nfrom prying eyes.", 
                               fill="#775566", font=("Helvetica", 11), justify=tk.CENTER)
        
        self.status_bar.config(text=f"Viewing {name} • AES-256 protected")
    
    def import_images(self):
        if not self.current_collection:
            messagebox.showwarning("No Collection", "Please select or create a collection first")
            return
        
        files = filedialog.askopenfilenames(
            title="Select your private images",
            filetypes=[("Image files", "*.png *.jpg *.jpeg *.webp *.bmp")]
        )
        
        if not files:
            return
        
        self.collections[self.current_collection]["images"].extend(files)
        
        self.image_list.delete(0, tk.END)
        for f in self.collections[self.current_collection]["images"]:
            self.image_list.insert(tk.END, os.path.basename(f))
        
        self.status_bar.config(text=f"Added {len(files)} sensitive images to collection")
    
    def add_images_to_current(self):
        self.import_images()
    
    def generate_key(self, password):
        salt = b'vv_sensual_salt_42'
        kdf = PBKDF2HMAC(
            algorithm=hashes.SHA256(),
            length=32,
            salt=salt,
            iterations=600000,
        )
        key = base64.urlsafe_b64encode(kdf.derive(password.encode()))
        return key
    
    def encrypt_current_collection(self):
        if not self.current_collection or not self.collections[self.current_collection]["images"]:
            messagebox.showinfo("Nothing to hide", "Add some private images first")
            return
        
        password = tk.simpledialog.askstring("Protect Collection", 
                                           "Enter a strong password to encrypt your private collection:",
                                           show='•', parent=self.root)
        if not password or len(password) < 6:
            return
        
        self.key = self.generate_key(password)
        self.fernet = Fernet(self.key)
        
        collection_data = {
            "images": [],
            "metadata": {
                "created": time.time(),
                "count": len(self.collections[self.current_collection]["images"])
            }
        }
        
        for img_path in self.collections[self.current_collection]["images"]:
            try:
                with open(img_path, "rb") as f:
                    data = f.read()
                
                encrypted = self.fernet.encrypt(data)
                collection_data["images"].append({
                    "name": os.path.basename(img_path),
                    "data": base64.b64encode(encrypted).decode('utf-8')
                })
            except Exception as e:
                print(f"Failed to encrypt {img_path}: {e}")
        
        # Save encrypted vault
        vault_path = self.collections[self.current_collection]["path"]
        with open(vault_path, "w") as f:
            json.dump(collection_data, f)
        
        # Clear original images from memory (but keep paths for reference)
        self.status_bar.config(text=f"Collection {self.current_collection} successfully encrypted and hidden")
        messagebox.showinfo("Hidden", "Your private collection has been encrypted and securely stored.\n"
                            "Original files remain untouched.")
    
    def decrypt_current_collection(self):
        if not self.current_collection:
            return
        
        vault_path = self.collections[self.current_collection]["path"]
        if not os.path.exists(vault_path):
            messagebox.showerror("Not Found", "No encrypted collection found")
            return
        
        password = tk.simpledialog.askstring("Reveal Collection", 
                                           "Enter password to decrypt your private treasures:",
                                           show='•', parent=self.root)
        if not password:
            return
        
        try:
            self.key = self.generate_key(password)
            self.fernet = Fernet(self.key)
            
            with open(vault_path, "r") as f:
                data = json.load(f)
            
            output_dir = os.path.join(self.vault_path, f"{self.current_collection}_revealed")
            os.makedirs(output_dir, exist_ok=True)
            
            for item in data["images"]:
                encrypted = base64.b64decode(item["data"])
                decrypted = self.fernet.decrypt(encrypted)
                
                out_path = os.path.join(output_dir, item["name"])
                with open(out_path, "wb") as f:
                    f.write(decrypted)
            
            messagebox.showinfo("Revealed", f"Collection decrypted to:\n{output_dir}\n\n"
                               "Enjoy your private collection in complete privacy.")
            self.status_bar.config(text="Collection decrypted. Files available in revealed folder.")
            
            # Open folder
            if os.name == "nt":
                os.startfile(output_dir)
            else:
                os.system(f'open "{output_dir}"' if os.name == "posix" else f'xdg-open "{output_dir}"')
                
        except Exception as e:
            messagebox.showerror("Access Denied", "Incorrect password or corrupted collection.")
            self.status_bar.config(text="Decryption failed - wrong password?")
    
    def run(self):
        self.root.mainloop()

if __name__ == "__main__":
    print("Starting VelvetVault - Your private sensual image guardian")
    root = tk.Tk()
    app = DarkSensualImageVault(root)
    app.run()

Prompt

Generate a Python code to implement a locally running image safe browsing tool that can encrypt and hide private sensitive collections. The interface uses dark style with slight sensual lighting effects.

Generator starting settings

Model
Uncensored Code
Mode
chat
View collection

Questions about this prompt

What is this AI code prompt about?

This prompt focuses on “Secure Image Vault Browser Tool”: Encrypted local image vault browser in Python. It is ready to use for code generation on HackAIGC.

How do I use this prompt on HackAIGC?

Open the prompt, tap Use prompt or Copy prompt, then run it with your preferred model and settings.

What approach does this code prompt use?

The brief for “Secure Image Vault Browser Tool” includes dark cues. Edit the prompt to change the tone, structure, or level of detail.

Can I edit this prompt before generating?

Yes. Copy the prompt text, modify details, then generate again on HackAIGC.