⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start.asv

📁 用MATLAB实现的RSA。界面友好
💻 ASV
字号:
function varargout = start(varargin)
% START M-file for start.fig
%      START, by itself, creates a new START or raises the existing
%      singleton*.
%
%      H = START returns the handle to a new START or the handle to
%      the existing singleton*.
%
%      START('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in START.M with the given input arguments.
%
%      START('Property','Value',...) creates a new START or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before start_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to start_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help start

% Last Modified by GUIDE v2.5 26-May-2005 07:40:10

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @start_OpeningFcn, ...
                   'gui_OutputFcn',  @start_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before start is made visible.
function start_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to start (see VARARGIN)

% Choose default command line output for start
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes start wait for user response (see UIRESUME)
% uiwait(handles.Start);


% --- Outputs from this function are returned to the command line.
function varargout = start_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes during object creation, after setting all properties.
function editBefore_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editBefore (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

% --- Executes during object creation, after setting all properties.
function editAfter_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editAfter (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

% --- Executes on button press in btnReset.
function btnReset_Callback(hObject, eventdata, handles)
% hObject    handle to btnReset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
hP=findobj('tag','editBefore');
set(hP,'string','');
hQ=findobj('tag','editAfter');
set(hQ,'string','');

% --- Executes on button press in btnExit.
function btnExit_Callback(hObject, eventdata, handles)
% hObject    handle to btnExit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close;


% --- Executes on button press in btnAbout.
function btnAbout_Callback(hObject, eventdata, handles)
% hObject    handle to btnAbout (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open('about.fig');


% --- Executes on button press in btnAuto.
function btnAuto_Callback(hObject, eventdata, handles)
% hObject    handle to btnAuto (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
p=unidrnd(3000)+3000;

while IsPrime(p)==0;
    p=unidrnd(3000)+3000;
end

q=unidrnd(3000)+6000;
while IsPrime(q)==0;
    q=unidrnd(3000)+6000;
end

n=p*q;

e=unidrnd(3000);
while gcd(e, (p-1)*(q-1))~=1;
    e=unidrnd(3000);
end

d=GetInv(e, (p-1)*(q-1));

hN=findobj('tag','txtInt');
set(hN,'string',num2str(n));
hO=findobj('tag','txtEnExp');
set(hO,'string',num2str(e));
he=findobj('tag','txtPrime');
set(he,'string',strcat(strcat(num2str(p),','),num2str(q)));
hd=findobj('tag','txtDeExp');
set(hd,'string',num2str(d));

% --- Executes on button press in btnArti.
function btnArti_Callback(hObject, eventdata, handles)
% hObject    handle to btnArti (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open('KEY.fig');
h=findobj

% --- Executes on button press in btnEn.
function btnEn_Callback(hObject, eventdata, handles)
% hObject    handle to btnEn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
hBefore=findobj('tag','editBefore');
s=get(hBefore,'String');
hEn=findobj('tag','txtEnExp');
e=str2num(get(hEn,'String'));
hInt=findobj('tag','txtInt');
n=str2num(get(hInt,'String'));
x=num2str(Encode(s,e,n));
hAfter=findobj('tag','editAfter');
set(hAfter,'String',x);

% --- Executes on button press in btnDe.
function btnDe_Callback(hObject, eventdata, handles)
% hObject    handle to btnDe (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
hBefore=findobj('tag','editBefore');
s=get(hBefore,'String');
hDn=findobj('tag','txtDeExp');
d=str2num(get(hDn,'string'));
hInt=findobj('tag','txtInt');
n=str2num(get(hInt,'string'));
x=num2str(Decode(s,d,n));
hAfter=findobj('tag','editAfter');
set(hAfter,'String',x);


% --- Executes on button press in btnReset.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to btnReset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in btnExit.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to btnExit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in btnAbout.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to btnAbout (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over btnAuto.
function btnAuto_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to btnAuto (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over btnAbout.
function btnAbout_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to btnAbout (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)






function editAfter_Callback(hObject, eventdata, handles)
% hObject    handle to editAfter (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editAfter as text
%        str2double(get(hObject,'String')) returns contents of editAfter as a double



function editBefore_Callback(hObject, eventdata, handles)
% hObject    handle to editBefore (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editBefore as text
%        str2double(get(hObject,'String')) returns contents of editBefore as a double


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -